,當我使用的fopen我收到以下錯誤某些原因:如何將文本寫入XML文件?
未能打開流:HTTP包裝不支持/examplefolder/examplefile.php
寫連接當我使用這個:
<?php
$myFile = "http://url.com/" . $_COOKIE['user'] . "/current_pro_pic.xml";
$xmlw = new XMLWriter;
$xmlw->setIndent(true);
$xmlw->startDocument('1.0', 'UTF-8');
$xmlw->startElement('user_current_pro_pic');
$xmlw->writeElement('full_url', "<![CDATA[sometexthere*]]>");
$xmlw->writeElement('time', date('l F jS Y ') . 'at' . date(' h:i A'));
$xmlw->endElement();
$xmlw->endElement();
$xmlw->endElement();
$xmlw->endDocument();
?>
它吐出了這一點:
Warning: XMLWriter::setIndent() [xmlwriter.setindent]: Invalid or unitialized XMLWriter object in *** on line 4
Warning: XMLWriter::startDocument() [xmlwriter.startdocument]: Invalid or unitialized XMLWriter object in *** on line 5
Warning: XMLWriter::startElement() [xmlwriter.startelement]: Invalid or unitialized XMLWriter object in ***p on line 6
Warning: XMLWriter::writeElement() [xmlwriter.writeelement]: Invalid or unitialized XMLWriter object in *** on line 7
Warning: XMLWriter::writeElement() [xmlwriter.writeelement]: Invalid or unitialized XMLWriter object in *** on line 8
Warning: XMLWriter::endElement() [xmlwriter.endelement]: Invalid or unitialized XMLWriter object in *** on line 9
Warning: XMLWriter::endElement() [xmlwriter.endelement]: Invalid or unitialized XMLWriter object in *** on line 10
Warning: XMLWriter::endElement() [xmlwriter.endelement]: Invalid or unitialized XMLWriter object in *** on line 11
Warning: XMLWriter::endDocument() [xmlwriter.enddocument]: Invalid or unitialized XMLWriter object in *** on line 12
有誰知道爲什麼會發生這種情況?它不是文件權限,也不是fyi。
您需要使用的文件路徑,而不是一個URL的。 – 2011-04-01 22:48:04