Skip to content
Advertisement

PHP: How do I figure out where file_put_contents is going to save a file?

If I just use file_put_contents(‘file.txt’, $stuff), how do I determine where that’s going to save? In some files it saves to a completely different folder.

Advertisement

Answer

log/echo both $stuff and getcwd(). If you don’t want to analyse such pairs, use realpath()

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement