2015-06-07 83 views
0

你好,這是我想提出一個變量到數組代碼

class NewTest extends BaseExample { 
    public function render() { 
    $startDate = $this->getNow(); 
    $endDate = $this->getNow(); 
    $optParams = array(
     'metric' => array('EARNINGS'), 
     'useTimezoneReporting' => true, 
     'filter' => 'DOMAIN_NAME==' .$sub. ',  
    ); 

我試過' .$sub.'和$子,但它不工作

+0

你錯過了'''在過濾器行的末尾。 –

回答

0

小語法錯誤 - 只是不得不刪除最後. '

class NewTest extends BaseExample { 
    public function render() { 
    $startDate = $this->getNow(); 
    $endDate = $this->getNow(); 
    $optParams = array(
    'metric' => array('EARNINGS'), 
    'useTimezoneReporting' => true, 
    'filter' => 'DOMAIN_NAME==' . $sub,  
    ); 
} 
} 
+0

這是我收到的錯誤http://misviral.com/adsense/mostawesomeposts.com/examples/adsense/?sub=travel.misviral.com&action=NewTest – Souljah

0

一個'缺少

'filter' => 'DOMAIN_NAME==' .$sub. '', 

既然是沒用的,這應該是更好的

'filter' => 'DOMAIN_NAME==' .$sub, 
+0

這是我收到的錯誤http://misviral.com/的AdSense/mostawesomeposts.com /示例/的AdSense /?子= travel.misviral.com和行動= NewTest – Souljah

0

刪除 '

class NewTest extends BaseExample { 
    public function render() { 
    $startDate = $this->getNow(); 
    $endDate = $this->getNow(); 
    $optParams = array(
     'metric' => array('EARNINGS'), 
     'useTimezoneReporting' => true, 
     'filter' => 'DOMAIN_NAME==' .$sub,  
    ); 
相關問題