• notice
  • Congratulations on the launch of the Sought Tech site

scandir() has been disabled for security reasons

    During the development process, if a certain function is encountered for security reasons, it is disabled, for example: scandir () has been disabled for security reasons, because there is this function in the disable_functions in the ini configuration of PHP.Of course, you can modify the settings of php.ini, or you can replace this sensitive function with other functions or self建方法。 Construction method.

    Because I have always used the opendir and readdir methods when I advance the directory, I saw a function scandir when I looked at the underlying system code of Baidu , I found it very good, it can save a lot of things, but I reported the above error in my Alibaba Cloud, it was obviously disabled, but there must be a reason for being disabled, so here we can use a method, you can First use ini_get to get the configuration value of disable_functions to check whether there is this function in the function you want to use, if not, use it, if there is, you can only use opendir honestly.

    There is one more thing to note here: for the ini_get function, before PHP5.3.0, when the configuration item does not exist, it will return an empty string , And will return FALSE after PHP5.3.0. 

Tags

Technical otaku

Sought technology together

Related Topic

0 Comments

Leave a Reply

+