Php会话变量问题

时间:2014-04-18 08:32:36

标签: php arrays function output

页面上出现的错误如下 严格标准:只应在第12行的/home/user/public_html/ref/testing_12345/index.php中通过引用传递变量

<?php       
session_start();
$cid = $_SESSION['cid'];
$gid = $_SESSION['gid'];
require_once 'jsonRPCClient.php';
$api_key = '/secret/';
$api_url = 'http://api2./secret/.com';
$client = new jsonRPCClient($api_url);
$campaigns = $client->get_campaigns(
    $api_key,array ('name' => array ( 'EQUALS' => 'thepride' ))
);
$CAMPAIGN_ID = array_pop(array_keys($campaigns));

if(isset($_POST['submit'])) 
{
    $camp_arr = array (
    'campaign'  => $CAMPAIGN_ID,
    'name'      => 'Test',
    'email'     => 'test@test.test',
);
$result = $client->add_contact($api_key, $camp_arr);
$site_url = $cid.".pokemon.com";    
header("Location: http://$site_url") ;
}
?>

1 个答案:

答案 0 :(得分:4)

你在这一行有问题..

$CAMPAIGN_ID = array_pop(array_keys($campaigns));

分手......

$CAMPAIGN_ID = array_keys($campaigns);
$CAMPAIGN_ID = array_pop($CAMPAIGN_ID);

原因:

array_pop()函数需要一个数组变量(通过引用),而不是值。