简体   繁体   中英

Access PHP File Cross-Domain

I have a bunch of arrays in a php file that I'd like to access across domains (same server).

If I simply try to include the file, I get " URL file-access is disabled in the server configuration". Now, I have read that I can change the php.ini file on my server to allow file access, but I'm also assuming this is a security hole.

Is there any other way to achieve what I'm trying to accomplish? I don't want to have to constantly update/upload this php file to every new site I create, having 1 universal file is much easier.

Edit for more info: I'm using WebhostManager, and I see an option to allow url fopen, which is set to yes, but there is no option for file access.

Thanks!

I've not used it yet so can't give an example but I'm going to need to do the same soon.

Try researching "symbolic links". That is if your using UNIX.

If IIS you can use "virtual directories"

Essentially both methods are creating faux folders that seem as if they are in your directory structure to a web user.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM