The principle is actually very simple. It is to use apc_bin_dumpfile to generate opcode files for many PHP file codes. When used, load the opcode file apc_bin_loadfile. The original code file is cleared. Generate a single opcode file. Note that the apc. ini file is set to apc. stat = off; var_dump (ini_get (apc. stat); $ arr_fi
The principle is actually very simple, that is, many PHP file codes are generated into opcode files using apc_bin_dumpfile; when used, apc_bin_loadfile is loaded into the opcode file. The original code file is cleared. Generate a single opcode file. Note that the apc. ini file is set to apc. stat = off; var_dump (ini_get ('apc. stat'); $ arr_fi
The principle is actually very simple, that is, many PHP file codes are generated into opcode files using apc_bin_dumpfile; when used, apc_bin_loadfile is loaded into the opcode file. The original code file is cleared.
Generate a single opcode file. Note that apc. ini is set to apc. stat = off;
Var_dump (ini_get ('apc. stat'); $ arr_files = glob_recursive ("/var/www/html/models/*. php"); // echo'';print_r($arr_files );var_dump(__DIR__.'/models.bin');foreach ($arr_files as $filename) { //echo "$filename size " . filesize($filename) . "\n
"; @require_once $filename; //$output = str_replace('/models/', '/models2/', $filename); //echo $output;exit; //@mkdir(dirname($output),true); //file_put_contents($output, '');}foreach($arr_files as $filename){//recompile again,maybe not usableapc_compile_file($filename);}$flag = @apc_bin_dumpfile($arr_files, array(), __DIR__.'/models.bin');var_dump($flag);
And then you can use it.
$flag = apc_bin_loadfile( BAOGG_ROOT.'models.bin');set_include_path(get_include_path() . PATH_SEPARATOR . ‘/var/www/html/models/’);
Refer:
Http://www.laruence.com/2012/08/16/2701.html
Http://hi.baidu.com/leolance/item/d115f9f6475208ca531c2693