>백엔드 개발 >PHP 튜토리얼 >小白大神,关于php创建文件

小白大神,关于php创建文件

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB원래의
2016-06-20 12:43:48836검색

把一个b.php文件放在a/b目录,让b.php能在a目录自动创建一个a.php文件


a.php文件的内容例如
内容
?>


求b.php的完整代码,谢谢各位大神了


回复讨论(解决方案)


$content = echo "this is page a";
?>
EOT;

$file = file_put_contents('../a.php', $content);;

$str = file_get_contents('../a.php');

echo htmlspecialchars($str);


$content = echo "this is page a";
?>
EOT;

$file = file_put_contents('../a.php', $content);;

$str = file_get_contents('../a.php');

echo htmlspecialchars($str);



谢谢,请问让自动生成的a.php自动生成内容啊



$content = echo "this is page a";
?>
EOT;

$file = file_put_contents('../a.php', $content);;

$str = file_get_contents('../a.php');

echo htmlspecialchars($str);



谢谢,请问让自动生成的a.php自动生成内容啊 没明白你的意思,你把a.php的内容作为字符串传给file_put_contents然后设置好路径就可以的
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.