The following is an example of a PHP dynamically generated function. The eval function is used in the example. I feel that it is very dangerous if the server allows users to run such a function
Copy code The code is as follows:
$a['a']=1;
$a['b']=1;
$a['c']=1;
$str="function a(){global $a;if($a['a']= =1 && $a['b']==1 && $a['c']==1){return 'OK';}else{return 'ERR';}}";
eval($str );
if(a()=="OK"){
echo "GOOD";
}else{
echo "OH NO";
}
http://www.bkjia.com/PHPjc/744326.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/744326.htmlTechArticleThe following is an example of a PHP dynamically generated function. The eval function is used in the example. I feel that if the server allows users to run this The function is very dangerous to copy the code. The code is as follows: ?...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn