企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
订单号函数: ~~~ public static function makeOrderNo() { $yCode = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'); $orderSn = $yCode[intval(date('Y')) - 2017] . strtoupper(dechex(date('m'))) . date( 'd') . substr(time(), -5) . substr(microtime(), 2, 5) . sprintf( '%02d', rand(0, 99)); return $orderSn; } ~~~ 获取php的执行文件 ``` define('IS_CLI', PHP_SAPI == 'cli' ? true : false); define('IS_WIN', strpos(PHP_OS, 'WIN') !== false); function detect_php_exe(){ static $php_filename=null; if(!isset($php_filename)){ $ds=DIRECTORY_SEPARATOR; $ini_all=ini_get_all(); //D:\phpstudy_pro\Extensions\php\php7.3.9nts\ext $php_ext_path=$ini_all['extension_dir']['local_value']; if($php_ext_path){ $php_ext_path=preg_replace("/[\/\\\]+/", '/', $php_ext_path); $phpPaths=explode('/', $php_ext_path); $phpPath=''; if(IS_WIN){ foreach ($phpPaths as $v){ $phpPath.=$v.$ds; if(is_file($phpPath.'php-cli.exe')){ $php_filename=$phpPath.'php-cli.exe'; break; }elseif(is_file($phpPath.'php.exe')){ //$phpPath: D:\phpstudy_pro\Extensions\php\php7.3.9nts\ $php_filename=$phpPath.'php.exe'; break; } } }else{ foreach ($phpPaths as $v){ $phpPath.=$v.$ds; if(is_file($phpPath.'bin'.$ds.'php')){ $php_filename=$phpPath.'bin'.$ds.'php'; break; } } } }else{ $php_filename='php'; } } return $php_filename; } $a=detect_php_exe();//D:\phpstudy_pro\Extensions\php\php7.3.9nts\php.exe ```