'href =' <? =変数?> 'をHTML/PHPのWebページで表示

2016-09-04 9 views
0

私はそれが説明されたときに愚かな気持ちになると感じていますが、'href =' <? =変数?> 'をHTML/PHPのWebページで表示

href='<?= $authUrl ?>' 

以下のGoogle API認証ログインコードから取得しました。

<div class="box"> 
    <?php if (isset($authUrl)): ?> 
    <div class="request"> 
    <a class='login' href='<?= $authUrl ?>'>Connect Me!</a> 
    </div> 
    <?php elseif($_SERVER['REQUEST_METHOD'] == 'POST'): ?> 
    <div class="shortened"> 
    <p>Your call was successful! Check your drive for the following files:  </p> 
    </div> 
    <?php else: ?> 
    <form method="POST"> 
    <input type="submit" value="Click here to list your tables" /> 
    </form> 
<?php endif ?> 
</div> 

答えて

1

PHPは

<?php 
    $foo = "bar"; 
?> 
<a href="<?= $foo ?>">I'm linking to bar </a> 
+1

おかげ例えば、よく説明.. – TrueBlue

+0

どういたしましてエコーの短縮バージョンを持っています。お役に立てて嬉しいです –

関連する問題