Adding functions to PHP core

前端 未结 5 758
礼貌的吻别
礼貌的吻别 2021-01-22 17:56

I have several functions that I wrote and I use regularly on my servers, is there a way I can add them to the core so I don\'t have to include them from external files?

5条回答
  •  旧时难觅i
    2021-01-22 18:45

    If you want your function to always be available, without including it, do this:

    Create your function in an php file.

    In your php.ini search for the option "auto_prepend_file" and add your php file to that line, like this: auto_prepend_file = "/path/to/my_superglobal_function.php"

    Or if you write without a path like this: auto_prepend_file = "my_superglobal_function.php" It will look in your include_path in php.ini to find the file.

提交回复
热议问题