更新时间:2023-12-01 13:38:40
< PHP$常用3 = 1 [user_id说明=!];//打印$ ARR的所有元素
的print_r($ ARR);呼应'< BR />'$改编[user_id说明=!]。
运行上面的code。我认为user_id说明!=不是指标名称的问题,因为它工作正常。
Unable to send special symbols in array keys using $http POST method in AngularJS
Here is my AngularJS Code:
var httpHeader = {
headers: { 'Content-Type': "application/x-www-form-urlencoded;" }
};
var postData = { 'user_id !=': 1 };
$http.post("http://localhost/api/view/country", $httpParamSerializer(postData), httpHeader)
.then(function (response) {
var data = response.data;
});
in PHP when i do:
var_dump($_POST);
it shows:
array(1) {
[0]=>
string(1) "1"
}
it should be like:
array(1) {
[user_id !=]=>
string(1) "1"
}
When i send it without "!=" it works fine. What should i do to sort out this? Thanks
<?php
$arr["user_id !="] = 1;
// Print all the elements of $arr
print_r($arr);
echo '<br/>'.$arr["user_id !="] ;
Run the above code. I think "user_id !=" is not a problem of index name as it works fine.