Angle brackets in PHP string

試著忘記壹切 提交于 2019-12-02 23:17:26

问题


It keeps killing me for some time...

I'm new to php and I'm writing a parser for price comparison site, therefore I need to have quite a few variables:

$plae = "<pastwisko>";
$user = "<krowa>";
$product "<trawa>";

But without spaces...

Using or echoing those gives me nothing. I've tried to search stackoverflow, google and php documentation and nothing... maybe my english sucks...

Thou I'll be really greatfull for help


回答1:


If you are echoing those into HTML then they will be parsed as [incorrect] HTML tags by your browser and will not show. You should use htmlentities to make them display as text: http://php.net/manual/en/function.htmlentities.php




回答2:


You've forgot a "=".

$product "<trawa>";
// Should be.
$product = "<trawa>";

Edit: Joe has the correct answer to your problem, I ran the script in the terminal and that was the only error I was given. I didn't think of htmlentities, I'm sorry if my post was irrelevant and unnecessary.



来源:https://stackoverflow.com/questions/7808446/angle-brackets-in-php-string

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!