开发者

PHP: Cannot assign string value to variable [closed]

开发者 https://www.devze.com 2023-02-20 16:41 出处:网络
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time,or an extraordinarily narrow situation that is not generally applic
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. 开发者_C百科 Closed 10 years ago.
if($page_name == "top_sites"){

$page_text = "<a href="http://www.mysite.com/top-site">Top 200</a>";
}

this code not work please help me to correct it


You need to escape your "

So just put a \ before them:

$page_text = "<a href=\"http://www.mysite.com/top-site\">Top 200</a>";

Alternatively you could use single quotes round the string:

$page_text = '<a href="http://www.mysite.com/top-site">Top 200</a>';


if($page_name == "top_sites"){

    $page_text = '<a href="http://www.mysite.com/top-site">Top 200</a>';

}
0

精彩评论

暂无评论...
验证码 换一张
取 消