这是我的代码:
<?php
require('phpQuery.php');
function download($url)
{
$curl = curl_init();
curl_setopt_array($curl, array
(
CURLOPT_URL => $url,
CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/22.0.1207.1 Safari/537.1',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CONNECTTIMEOUT => 120,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HEADER => false
));
$data = curl_exec($curl);
curl_close($curl);
return $data;
}
$pagina1 = phpQuery::newDocument(download('http://google.com'));
$logosrc = pq('img#hplogo').attr('src');
echo $logosrc;
?>
错误:
致命错误:在第 26 行调用 C:\xampp\htdocs\projects\new\extract.php 中未定义的函数 attr()
谁知道问题出在哪里?