duanqilupinf67040 2018-08-13 05:58
浏览 89
已采纳

如何在php中定义常量并从所有文件访问它而不包括常量文件(任何类似于.Net中的AppSettings)

I want define some constants and access those from any file without including any file in php.

in the other word i search for any equivalent of Web.Config->AppSettings in C#

  • 写回答

1条回答 默认 最新

  • donglie1994 2018-08-13 09:36
    关注

    You should define them in a file called constants.php and then change your php.ini settings so that this file is always loaded, before anything else:

    auto_prepend_file = /var/www/website/constants.php
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?