Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QUESTION write to file doesn't like absolute path?
#1
I'm curious and maybe I've just missed something but when I try to use get_theme_url as part of the file path I can't write to file, however when I use a relative path then all works fine.

It's Friday, it been a long week so maybe I'm just missing something stupid. Just wondered if anyone had an idea.

Absolute path  - Used within a file in the theme folder:
Code:
$dataStr = "testing 123";

$fpath = get_theme_url(false)."data33.txt";
                           
file_put_contents($fpath,$dataStr);

And yet if I use the relative path without including the function 'get_theme_url()', all works fine.

Code:
file_put_contents("theme/helpdesks/data33.txt",$dataStr);
Reply


Messages In This Thread
write to file doesn't like absolute path? - by craiga - 2019-02-22, 21:17:26



Users browsing this thread: 1 Guest(s)