我想在PHP $par_id = '31512071';
函数中使用array();
变量。
我尝试在以下php代码中使用"par_id" => $par_id
而不是"par_id" => 31512071
,但它不起作用。如何在array();
方法中使用变量?
$par_id = '31512071';
$params = array(
"parcelNum" => "315-12-071",
"b_2" => "Search",
"opts"=>"2",
"txtPageSize" => 10,
"par_id" => 31512071
);
答案 0 :(得分:2)
你可以这样做:
$par_id = '31512071';
$params = array(
"parcelNum" => "315-12-071",
"b_2" => "Search",
"opts"=>"2",
"txtPageSize" => 10,
"par_id" => "{$par_id}"
);