Best Practices for creating a PHP INI/CONFIG file and keep it secure

后端 未结 3 1296
情书的邮戳
情书的邮戳 2021-02-10 10:45

I always used a normal PHP file and just defined the variables in that file, but is this considered best practice?

Example:



        
3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-10 10:56

    It is quite safe and I don't think there is any best practice for constants, but I tend to gather them in a dedicated Constants class for readability:

    class Constants {
        const DB_PASS = 'mypass';
    }
    

提交回复
热议问题