原文网址:http://www.cnblogs.com/mengdd/archive/2013/02/16/2913659.html 先看一个程序例子: public class HelloThreadTest { public static void main(String[] args) { HelloThread r = new HelloThread(); Thread t1 = new Thread(r); Thread t2 = new Thread(r); t1.start();
先看一个程序例子: public class HelloThreadTest { public static void main(String[] args) { HelloThread r = new HelloThread(); Thread t1 = new Thread(r); Thread t2 = new Thread(r); t1.start(); t2.start(); } } class HelloThread implements Runnable { int i; @Ove
class A{ private $url; public function __construct(){ $this->url = $_SERVER['PATCH_INFO']; } public static function get(){ var_dump(self::$url);//出错,说静态变量未初始化 var_dump($this->url);//也出错,说无法使用this; } } get里想取出$url该如何实现?方法如下: class A { //方法1 private s