PHP create a file without fopen

2019-02-21 06:41发布

问题:

Is there a way to create a file with PHP when fopen is disabled? Other functions to access the file system are enabled such as file_get_contents().

回答1:

look up file_put_contents()... though if fopen has been disabled it may also be disabled. Getting and putting files are two different things from a permissions perspective.

And if fopen has been disabled, I can't imagine that exec() hasn't also been disabled.



回答2:

touch('file.txt');

Maybe the simplest.



标签: php fopen