2014-01-07 98 views
0

PHP documentation狀態:可用的PHP開始和結束標記

<%= $variable; # This is a shortcut for "<% echo . . ." %> 

<?= expression ?> This is a shortcut for "<? echo expression ?>" 

...short tags and ASP style tags, and can be turned on and off from the php.ini configuration file.

所以我試圖嘗試對ASP風格標記和短標記的「捷徑」,以驗證這些語句。我得到這個:

解析錯誤:語法錯誤,意想不到的 '迴響'(T_ECHO)在C:\用戶\羅伯特\文件\ web開發\ XAMPP \ htdocs中\ XAMPP \ web_development \ new_study \上線on​​e.php 2

在一個簡單的代碼行這樣的:

<%= echo "tom" %> 

<?= echo "tom" ?> 

有誰知道爲什麼是這樣的話?

+1

走字回聲出,隨着=已經這樣做 –

+0

你在本質上說'<?PHP的回聲回聲「湯姆」?>' –

+2

這個問題似乎是因爲它是關於語法問題的話題。 –

回答

5

代碼應該是

<%= "tom" %> 
相關問題