我将Current PHP version: 7.1.4
用于Ionic2
应用后端。
我正在尝试在ftp server
上创建文件夹。直接链接到php文件http://site/php/directory.php
echo is
成功创建图像
在此之后,目录中不存在文件夹images
,并且第二个链接指向php,消息为:
警告:ftp_mkdir():无法创建目录:文件存在于 第8行/ path/php/directory.php创建图像时出错
但是文件夹images
未创建,并且在目录中不存在。然后我用FTP客户端工具手动创建了一个文件夹images
,这种文件夹实际上是通常创建的。
如果未创建文件夹http://site/php/directory.php
,为什么第一个链接指向Successfully created images
echo为Can't create directory: File exists in
,第二个链接为images
,之后我也能够创建文件夹images
手动。我不确定,可能是某些特定的默认服务器设置,或某种隐藏文件夹。我没有隐藏文件,所以不知道这里有什么问题:
<?php
$ftp_server = "ftp_address";
$ftp_conn = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
$login = ftp_login($ftp_conn, "ftp_username", "ftp_password");
$dir = "images";
if (ftp_mkdir($ftp_conn, $dir))
{
echo "Successfully created $dir";
}
else
{
echo "Error while creating $dir";
}
ftp_close($ftp_conn);
?>
答案 0 :(得分:0)
该文件夹已创建,但位于其他位置。你必须查找你的PHP代码实际执行的位置,然后你会找到错误创建的文件夹。
从我的观点来看:定义创建这样的文件夹或文件的位置非常棘手。但是有“show working directory”命令可以帮助你进行调试。