我得到了这个测试代码.
文件名:test.php
<?php
$array = array(
'host' => "@"
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://localhost/post.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $array);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);
?>
Run Code Online (Sandbox Code Playgroud)
这个,post.php
<?php
var_dump($_POST);
?>
Run Code Online (Sandbox Code Playgroud)
每当我使用"@"作为值时,我会得到这样的错误结果,
bool(false)
Run Code Online (Sandbox Code Playgroud)
但当我使用"@"或"任何@"时,我得到了这个结果
array(1) { ["host"]=> string(2) " @" }
Run Code Online (Sandbox Code Playgroud)
关于这个的任何解释和解决方案?
谢谢!