Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP相关文件仅在从dreamweaver启动时工作_Php_Xml_Dreamweaver - Fatal编程技术网

PHP相关文件仅在从dreamweaver启动时工作

PHP相关文件仅在从dreamweaver启动时工作,php,xml,dreamweaver,Php,Xml,Dreamweaver,我开始学习php,我制作了一个表单,使用php文件将信息写入xml文件。表单位于html文件中,php操作位于单独的文件中。我正在使用EasyHP 12.1 每当我使用上传表单通过dreamweaver发布时,一切都很顺利。 但是,当我直接将其打开到broswer中时,它会显示php代码的一部分。 这是html的代码 <form enctype="multipart/form-data" action="chng.php" method="POST"> <div>Name

我开始学习php,我制作了一个表单,使用php文件将信息写入xml文件。表单位于html文件中,php操作位于单独的文件中。我正在使用EasyHP 12.1

每当我使用上传表单通过dreamweaver发布时,一切都很顺利。 但是,当我直接将其打开到broswer中时,它会显示php代码的一部分。 这是html的代码

<form enctype="multipart/form-data" action="chng.php" method="POST">
<div>Name <input type='text' name="tf" /> </div>
<div>image <input name="uploadedfile1" type="file" /> </div><br />
<input type="submit"  />
</form>
然后,另一个页面使用jqueryajax提取xml信息


如前所述,如果我使用dreamweaver启动表单文件,一切正常。此外,有时,如果直接从浏览器打开显示xml信息的页面,则该页面将显示该信息;有时则不会显示该信息,但如果从dreamweaver打开,则该页面将始终显示该信息。我发现php的信息在dreamweaver中不起作用,但与我的情况相反。我必须做些什么才能让它一直有效吗?谢谢你提供的任何信息

如果你把它上传到你的服务器上,会有一个php解析器解析你的文件

如果您在本地打开它,它将不会被解析,因此它只是另一个文本文档

当然,您可以安装类似xampp的东西,以拥有一个本地Web服务器,但如果您刚刚起步,我想可能会有点太多:)

--编辑--

另外:请注意浏览器的行为。如果您的计算机上已经安装了Web服务器,它的地址通常类似于http://localhost/ 或http://127.0.0.1 -如果您的文件没有被解析,可能是因为它直接像C:\programm files\dreamweaver\whatever\index.php那样打开,而不是

http://localhost/index.php

希望这对你有帮助;)

微笑你也可以接受答案;)。这是一个典型的初学者错误——10年前我也是这样:D
$target_path4 = "../img/";
$target_path4 = $target_path4 . basename( $_FILES['uploadedfile4']['name']);
$name4="../img/linkimagen.jpg";

$t = $_POST['tf'];
if(move_uploaded_file($_FILES['uploadedfile4']['tmp_name'], $name4)) {


$xml = simplexml_load_file('info.xml');

$xml->names[0]=$t;
file_put_contents('info.xml', $xml->asXML());
$xml->images[0]=$shortname;
file_put_contents('info.xml', $xml->asXML());
}
?>