English 中文(简体)
XML+PHP+DOM “write on xml” 为什么没有在某个特定服务器上工作?
原标题:XML+PHP+DOM "write on xml" Why it s not working in a specific server?
  • 时间:2011-01-11 09:25:45
  •  标签:
  • php
  • xml

我只想说明为什么不在我的服务器上工作。

我希望有人会帮助我: 我将尽量明确这一点。

我在PHP+XML+DOM中做了很好的工作说明,书写为xml,用Xml阅读器显示。 并且为某些免费接待工作提供了良好效果

now..I copy the files into my server and it s not working. I can see the xml with the reader.. but i can t write on the xml file.

www.un.org/Depts/DGACM/index_spanish.htm 这些是这两个地方相同的档案。

Can you help me please?

www.un.org/Depts/DGACM/index_spanish.htm BTW:Feel Free to Add any data to the xml.it s only for the example.

<>Sites:

免费主办:

My Server: http://apps.sce.ac.il/testxml/asce/xml/XmlReader.php

<>pInfo>:

Free Hosting: http://ofear.onlinewebshop.net/xml/phpinfo.php

我的服务器:http://apps.sce.ac.il/testxml/asce/xml/phpinfo.php

<<>Files:

events.xml:

<?xml version="1.0" encoding="UTF-8" ?>
<events>
    <record>
        <event>1</event>
        <eventDate>2</eventDate>
        <desc>3</desc>
    </record>
</events>

<<>strong>parser.php:(我为脱胎添加了对应内容)<>。

<?php

header("Content-type: text/html; charset=utf-8");
echo("set header<br/>");

$record = array(
  event  => $_POST[ event ],
     eventDate  => $_POST[ eventDate ],
     desc  => $_POST[ desc ],
);
echo("set array<br/>");

$doc = new DOMDocument();
$doc->load(  events.xml  );
echo("make new dom and load the xml<br/>");

$doc->formatOutput = true;
echo("formatin output<br/>");

$r = $doc->getElementsByTagName("events")->item(0);
echo("get element events<br/>");

$b = $doc->createElement("record");
echo("create element record<br/>");

$event = $doc->createElement("event");
echo("create element event<br/>");

$event->appendChild(
    $doc->createTextNode( $record["event"] )
);
echo("create TextNode event<br/>");

$b->appendChild( $event );
echo("appendChild event<br/>");

$eventDate = $doc->createElement("eventDate");
$eventDate->appendChild(
    $doc->createTextNode( $record["eventDate"] )
);
echo("create TextNode eventDate<br/>");

$b->appendChild( $eventDate );
echo("appendChild eventDate<br/>");

$desc = $doc->createElement("desc");
$desc->appendChild(
    $doc->createTextNode( $record["desc"] )
);
echo("create TextNode desc<br/>");

$b->appendChild( $desc );
echo("appendChild desc<br/>");

$r->insertBefore( $b,$r->firstChild );
echo("insertBefore firstChild<br/>");

$doc->save("events.xml");
echo("Saving events.xml<br/>");

echo("<br/><br/><a href= XmlReader.php >Go Back to XML Reader</a><br/>");
   // header("Location: {$_SERVER[ HTTP_REFERER ]}");    
?>

<XmlReader.php:(只有php script)

<?php
$doc = new DOMDocument();
$doc->load(  events.xml  );

$events = $doc->getElementsByTagName( "record" );
foreach( $events as $record )
{
  $events = $record->getElementsByTagName( "event" );
  $event = $events->item(0)->nodeValue;

  $eventDates= $record->getElementsByTagName( "eventDate" );
  $eventDate= $eventDates->item(0)->nodeValue;

  $descs = $record->getElementsByTagName( "desc" );
  $desc = $descs->item(0)->nodeValue;

  echo "<tr><td>$event</td><td>$eventDate</td><td>$desc</td></tr>";
  }
?>
最佳回答

在档案许可方面,这是一个问题。

我对所有档案进行了755次许可,并解决了这一问题。

感谢 他的建议。

请增加以下错误:报告(E_ALL),伊_set(显示-errors, 1);顶端。 php管理文字并公布产出。

问题回答

暂无回答




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...