Jump to content

[SOLVED] How to read a file content in PW


Recommended Posts


i am trying to integrate a manfiest file into my PW page.

But it seems like file_get_contents is disabled somehow.

$manifest_path = 'path/to/manifest.json';
$hashes = json_decode(file_get_contents($manifest_path), TRUE);
$css_hash = $hashes['main.css'];
var_dump($css_hashe); // works only outside of of processwire. 

whats the correct way to include a file like this into PW?

Thanks for your help.

Link to comment
Share on other sites

Are you sure the path is correct? What if you omit true (i.e. don't just search in include-path) and use an absolute path?

PW doesn't disable this function.

If you're in devmode and/or have Tracy Debugger installed, you should see some hint why it's failing.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...