简体   繁体   中英

ModX/PHP: Have my own file in root directory that connects to DB?

I have a php file I want to use for JSON purposes in the root directory of my ModX CMS.

I want to connect that file to the database, without exposing any critical information such as database username and password.

There is a config file that holds the info located in a folder that is in accessible from browsers but I do not know how to get that info back to my php file.

Can anyone help me either: a) connect to the database securely straight from my php file b) use variables stored in the already secure config file to connect

Any help would be greatly appreciated!

Thanks!

如果要在额外文件中使用modx的所有功能,则可能要在外部加载modx ... http://rtfm.modx.com/display/revolution20/Loading+MODx+Externally

Basically I just added an include() going to the config file and it worked. Only issue was removing the ` marks which ModX adds to the database name. PLease let me know if anyone needs to clarify this more

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