PHP: Cannot assign string value to variable [closed]
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>';
}
精彩评论