나는 블로거 계정에서 블로그 게시물의 마지막 X 양을 표시하기 위해 스크립트를 보았지만 다음 경고 메시지가 나타납니다.PHP 도움말, 블로거 API/xml 경고가 필요하십니까?
경고 : 참조에 의한 전달 참조가 더 이상 사용되지 않습니다. 값; 참조로 전달하려면 xml_set_object()의 선언을 수정하십시오. 참조에 의한 호출 시간을 활성화하려면 INI 파일에서 allow_call_time_pass_reference를 true로 설정할 수 있습니다. 그러나 이후 버전에서는 더 이상이 기능을 지원하지 않을 수 있습니다.
<div id="latestentries">
<ul id="entrieslist">
<?php
class RSSParser {
var $insideitem = false;
var $tag = "";
var $title = "";
var $pubDate = "";
var $link = "";
var $thr = "";
var $counter = 1;
function startElement($parser, $tagName, $attrs) {
if ($this->insideitem) {
$this->tag = $tagName;
} elseif ($tagName == "ITEM") {
$this->insideitem = true;
}
}
function endElement($parser, $tagName) {
if ($this->counter < 5) {
if ($tagName == "ITEM") {
$title = htmlspecialchars(trim($this->title));
if (strlen($title) > 35) {
if ($this->thr > 0) {
$name = $title;
$name = $name . " ";
$name = substr($name,0,31);
$title = $name . " ...";
}
if (strlen($title) > 45) {
if ($this->thr == 0) {
$name2 = $title;
$name2 = $name2 . " ";
$name2 = substr($name2,0,41);
$title = $name2 . "...";
}
}
}
$date = htmlspecialchars(trim($this->pubDate));
$pubDate = substr($date,0,str_length-20) . ".";
printf("<li class='entry'><a href='%s'><span class='entrydate'>%s</span><span>%s</span>",trim($this->link),$pubDate,$title);
if ($this->thr == 1) { printf("<span class='entrycomments'>(%s Comment)</span>",$this->thr); }
elseif ($this->thr > 1) { printf("<span class='entrycomments'>(%s Comments)</span>",$this->thr); }
echo "</a></li>";
$counter = $this->counter;
$this->counter = $counter + 1;
$this->title = "";
$this->pubDate = "";
$this->link = "";
$this->thr = "";
$this->insideitem = false;
}
}
}
function characterData($parser, $data) {
if ($this->insideitem) {
switch ($this->tag) {
case "TITLE":
$this->title .= $data;
$this->counter .= $counter;
break;
case "PUBDATE":
$counter++;
$this->pubDate .= $data;
break;
case "LINK":
$counter++;
$this->link .= $data;
break;
case "THR:TOTAL":
$counter++;
$this->thr .= $data;
break;
}
}
}
}
$xml_parser = xml_parser_create();
$rss_parser = new RSSParser();
xml_set_object($xml_parser,&$rss_parser);
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
$fp = fopen("rss.xml","r")
or die("Error reading RSS data.");
while ($data = fread($fp, 4096))
xml_parse($xml_parser, $data, feof($fp))
or die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
fclose($fp);
xml_parser_free($xml_parser);
?>
</ul>
</div>
누군가가 나에게 경고를 해제 할 수 있도록, 또는 해결 방법을 내게 보여 수 : 여기
라인 (88)에 test.php의 코드는? :)
는 (느낌이 지금은 바보) .. 일이, 감사 당신은 내가 본 코드를 보았다하지 않는다면 – SoulieBaby
롤. :) – TheJacobTaylor
나는 확신한다. 당신의 도움에 감사합니다, 대단히 감사합니다! :) – SoulieBaby