Is there any way to file_put_contents
from different path i mean instead of
c/programfiles/../../htdocs/test.txt using c/test/test.txt
the below is the code i am using:
$date=current_date;
$file = "test_"$date".txt";
$contents = "testtest";
file_put_contents($file, $contents);
Many thanks in advance!
When placing files on your computer you can either use relative or absolute path like this:
// absolute path
$file = "C:/temp/test.txt";
// relative path from C:/Program Files/wamp/htdocs/index.php
$file = "../../temp/test.txt";
Both of those files point to the same place