Not directly. But you can add the following code at the beginning of your code to automatically include functions:
call_user_func(function($p,$w){$c=file_get_contents(__FILE__);$fs=explode('(',$c);$f=[];for($i=65;$i<=90;$i++){$vc[chr($i)]=1;$vc[chr($i+32)]=1;if($i<75)$vc[chr($i-17)]=1;}$vc['_']=1;foreach($fs as $fn){$fn=rtrim($fn);for($i=strlen($fn)-1;$i>=0;$i--){if(!isset($vc[$fn[$i]])){$f[]=substr($fn,$i+1);break;}}}foreach($f as $c){@include_once($p.$w[0].$c.$w[1]);}}, "func_dir/",["func_",".php"]);
The only thing you need to change is the second line: The first parameter is a folder to search for files, the second parameter is an array that wraps both values ββaround the function name.
For example: if your function files are located in the subdirectory "func_dir /" and are namen "func _ *. Php" (where * is the name of the function), you can use the above code directly as is. However, you must put this code in every file where you want to automatically load functions and adapt the path.
It is a little dirty, but it works. Hope my code helps you.
StanE Aug 30 '15 at 17:58 2015-08-30 17:58
source share