我无法在pthread运行函数中全局访问变量,我可以知道该怎么做吗?
class Promise extends Thread
{
public function __construct()
{
global $myVar;
echo "inside construct function variable " . $myVar;
}
public function run()
{
global $myVar;
echo "inside run function variable " . $myVar;
}
}
我可以在构造中访问myVar全局变量但不能运行函数吗?我能知道为什么吗?