2013-05-03 67 views
1

即时通讯不太好用的PHP,但即时通讯尝试学习如何履带功能。即时尝试应用我所了解的有关履带式机器人在本网站http://www.makeuseof.com/tag/build-basic-web-crawler-pull-information-website/什么是“解析错误:语法错误,意外'>'在example2.php”

一切都很好,直到我继续example2。我得到这个错误

解析错误:语法错误,从这个代码

<?php 
include_once('simple_html_dom.php'); 
$target_url = “localhost/wordpress”; 
$html = new simple_html_dom(); 
$html->load_file($target_url); 
foreach($html->find(‘a’) as $link){ 
echo $link->href.”<br/>”; 
} 
?> 

我知道这是一个简单的PHP,但意外“>”在第7行

example2.php像我这样的noob我不知道我应该在哪里看。希望你能帮上忙。谢谢

+7

呃,什么是时髦的双和单引号?我记得当我偶然将键盘设置为日语时出现了这种错误,那么我的所有引号实际上都是多字节字符,导致PHP认为字符串没有结束。 – 2013-05-03 16:57:53

+2

严重的问题:你是否在MS Word或其他东西中编写代码? – 2013-05-03 17:02:32

+0

^哈哈让我的一天,对不起offtopic – 2013-05-03 17:04:02

回答

4

这里。

<?php 
include_once('simple_html_dom.php'); 
$target_url = 'localhost/wordpress'; 
$html = new simple_html_dom(); 
$html->load_file($target_url); 
foreach($html->find('a') as $link){ 
    echo $link->href.'<br/>'; 
} 
?> 

严重的是,在显示代码的网站上不正确的引号应该是非法的。

+0

就是这样。非常感谢你。我已经觉得很蠢 – MRu 2013-05-03 17:02:32

相关问题