0
나는이 링크가 http://lazhalazha.livejournal.com/data/rss
이고, 그 안에 RSS가 있어야하는데, 나는 배열에 guid
값을 가져야합니다. 이것은 링크에 대한 것입니다. 이PHP 개체 - 어떻게이 값에 액세스 할 수 있습니까?
$xml = simplexml_load_file('http://lazhalazha.livejournal.com/data/rss');
foreach ($xml->channel->item as $item){
print_r($item->guid);
}
출력은 다음 객체 대신 정확한 URL을 전달하는 것, 문자열이 객체를 변환하여이 문제를 해결 이러한 개체
SimpleXMLElement Object
(
[@attributes] => Array
(
[isPermaLink] => true
)
[0] => http://lazhalazha.livejournal.com/713.html
)
의 시리즈는 ... 내가 지금까지있는 것입니다.
$xml = simplexml_load_file('http://lazhalazha.livejournal.com/data/rss');
$linkArray = array();
foreach ($xml->channel->item as $item){
$guid = (string)$item->guid;
array_push($linkArray, $guid);
}
'당신의 첫번째 옵션에 대해 무엇을 work'하지 않는 이유는 무엇입니까? – Neal
@Neal 출력은 끝에 [0]이없는 것과 같습니다. – sed
PHP 매뉴얼의 simplexml 기본 사용 예제를 참조하십시오. – Gordon