2014-03-13 33 views
0

我有这个以下$ PATH:PHP触摸():无法创建,因为无效的参数文件

,P:\ XAMPP \ htdocs中\ WordPress的/可湿性粉剂内容/ _moduletest_tmp_ \ Y:\ XAMPP \ htdocs中\ WordPress的/可湿性粉剂内容/ _ ____

但是当我跑这个代码:

touch($path); 

我得到这个错误:

Warning  touch(): Unable to create file P:\xampp\htdocs\wordpress/wp-content/_moduletest_tmp_\P:\xampp\htdocs\wordpress/wp-content/______lock_____ because Invalid argument on line 733 in file P:\xampp\htdocs\wordpress\wp-content\plugins\module-test.php 

线733是这样的:

touch($path); 

任何建议如何解决呢?我使用PHP 5.4.17在Windows下运行XAMPP。

+0

它为什么要调用两个目录? 'P:\ xampp \ htdocs \ wordpress/wp-content/_moduletest_tmp_ \ P:\ xampp \ htdocs \ wordpress/wp-content/______ lock _____' – 13ruce1337

+0

你已经在你的目录中,windows使用\来显示不同的文件夹,它的外观,变量中的两条路径。通过将目录树复制并粘贴到资源管理器来检查路径。如果它没有去你想要的地方,这是不正确的。 – Impulss

+0

@ 13ruce1337 ..那是奇怪的.. –

回答

2
$path = 'P:/xampp/htdocs/wordpress/wp-content/'; 
    touch("$path" . "_moduletest_tmp_"); 
    touch("$path" . "_lock____"); 

确保目录P:/xampp/htdocs/wordpress/wp-content/存在。

+0

如果它不会创建它:[如果该文件不存在,它将被创建。](http://php.net/touch) – 13ruce1337

+2

编号'touch'在PHP中就像是Unix的。如果该目录不存在,它将不会创建该文件。 – bprayudha

+0

啊,谢谢你的知识。 +1 – 13ruce1337

相关问题