在php类中使用超级全局$\u GET

在php类中使用超级全局$\u GET,php,superglobals,Php,Superglobals,早上好, 我试图在PHP类中使用超全局“$\u GET”,但我的4个解决方案都不起作用。。。这是我最后一次尝试,有人能告诉我怎么了吗? 多谢各位 public $a; function __construct($options = null, $initialize = true, $error_messages = null) { $this->response = array(); if(isset($_GET['alb

早上好, 我试图在PHP类中使用超全局“$\u GET”,但我的4个解决方案都不起作用。。。这是我最后一次尝试,有人能告诉我怎么了吗? 多谢各位

   public $a;


    function __construct($options = null, $initialize = true, $error_messages = null) {
        $this->response = array();

               if(isset($_GET['album']){
            $this->a = $_GET['album'];
        }else{
            $this->a = null
        }

        $this->options = array(
            'script_url' => $this->get_full_url().'/'.basename($this->get_server_var('SCRIPT_NAME')),
            'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/files/',$a,'/',
            'upload_url' => $this->get_full_url().'/files/',$a,'/',

......
}

看起来您正在用逗号连接url:

 'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/files/',$a,'/',
 'upload_url' => $this->get_full_url().'/files/',$a,'/',
但如果$a为空,则会得到双斜杠。这一行缺少一个分号

$this->a = null

你的URL是否包含
?album=
?当然,我尝试了一些值。你可以考虑将$\u GET传递给构造函数(作为一种更好的设计方法)@zedd好吧,我发现了一些解决方案,每次它都在构造函数中,就像我的代码中一样
$this->a = null