-1
<?php 
include("lib/LIB_parse.php");
include("lib/LIB_http.php");
# Include parse library
# Include PHP/CURL library
$web_page = http_get($target="http://www.ethiojobs.net", $referer="");
$meta_tag_array = parse_array($web_page['FILE'], "<meta", ">");

var_dump($meta_tag_array);

for($xx=0; $xx<count($meta_tag_array); $xx++)
echo $meta_tag_array[$xx]."\n";
?>

var_dump($meta_tag_array);

array (size=5)
  0 => string '<meta http-equiv="X-UA-Compatible" content="IE=edge" />' (length=55)
  1 => string '<meta name="keywords" content="Jobs, vacancies, Jobs in Ethiopia, Job search, recruitment in ethiopia, NGO jobs, heineken jobs, Finance Jobs, Marketing Jobs, Sales Jobs, Banking Jobs, Jobs in Addis Ababa, Jobs in Oromia, Jobs Ethiopia, IT Jobs, Management Jobs, Health care Jobs, Administrator Jobs, Accountant Jobs, Ethio jobs" />' (length=331)
  2 => string '<meta name="description" content="Find latest Jobs in Ethiopia, vacancies in Ethiopia on Ethiojobs. Apply now for Ethiopian NGO jobs, accounting and finance jobs and IT jobs. Recruitment in Ethiopia." />' (length=203)
  3 => string '<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>' (length=68)
  4 => string '<meta name="google-site-verification" content="ZtExAGSQvU8_4awYUYXKnF9Zp5WWJBv_e8CSDVy7gXc" />' (length=94)
4

1 回答 1

1
$web_page = "https://googel.com/";
    ^---string

$meta_tag_array = parse_array($web_page['FILE'], "<meta", ">");
                                    ^^^--array?

您不能在字符串数组上使用字符串键。那是完全不可能的。如果你试图将一个数组传递给这个函数,那么传递一个字符串显然是行不通的。

php > $x = "some string";
php > echo $x['foo'];
PHP Warning:  Illegal string offset 'foo' in php shell code on line 1
于 2016-07-29T15:58:22.357 回答