1
有沒有可能繼承包含文件和定義變量在pthread運行方法?我曾嘗試過PTHREADS_INHERIT_NONE
,但似乎 無法正常工作。我們使用了下面的代碼。pthread不繼承定義者,幷包含文件
$domain_root='/home/user/abc';
define('DIR_FS_DOMAIN_ROOT', $domain_root);
class NEWThread extends Thread{
public function __construct()
{
}
public function run()
{
$this->html=DIR_FS_DOMAIN_ROOT;
}
}
$th=new NEWThread(PTHREADS_INHERIT_NONE);
$th->start();
$th->join();
echo $th->html;