【问题标题】:Php session variables issuePHP会话变量问题
【发布时间】:2014-04-18 08:32:36
【问题描述】:

页面出现的错误如下 严格的标准:只有变量应该在第 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") ;
}
?>

【问题讨论】:

    标签: php arrays function output


    【解决方案1】:

    你在这行有问题..

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

    分手吧..

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

    原因:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-12-10
      • 2014-10-10
      • 1970-01-01
      • 2021-12-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-21
      相关资源
      最近更新 更多