如何在 NuSOAP 中传递撇号 (')?
我试图将包含撇号字符的参数传递给函数调用,但显然它被删除了。这就是我正在做的:
$input = array(
'kod_modelu' => "187'",
'nr_nadwozia' => '00552889'
);
$result = $client->call('certyfikat_gwarancji_dane_pobierz', $input);
var_dump($result);
在输出中我得到:(
'kod_modelu' => string '187' (length=3)
'nr_nadwozia' => string '00552889' (length=8)
我在输出中重复输入,并且撇号被删除)。
我该如何解决这个问题?
编辑:这是重现该问题的代码: Pastebin
I am trying to pass an argument containing apostrophe character to function call but apparently it is being stripped out. Here's what I am doing:
$input = array(
'kod_modelu' => "187'",
'nr_nadwozia' => '00552889'
);
$result = $client->call('certyfikat_gwarancji_dane_pobierz', $input);
var_dump($result);
And in output I'm getting:
'kod_modelu' => string '187' (length=3)
'nr_nadwozia' => string '00552889' (length=8)
(I am repeating input in output and apostrophe is being stripped out).
How can I solve this?
EDIT: Here's a code to reproduce the issue:
Pastebin
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好的,案件结束。
PHP 5.2.6 是问题(请参阅 bugs.php.net)。升级到最新版本的5.2.x分支解决了该问题。
Ok, case closed.
PHP 5.2.6 is the issue (referring to bugs.php.net). Upgrading to the latest version of 5.2.x branch solves the problem.
这可能是一个不太可能的事情,但由于 SOAP 是基于 XML 的,因此您的引号必须在某处转换为 XML 实体。
我没有使用 nuSOAP 的经验,但单引号的 XML 实体值是:
'
。参考PHP函数:htmlspecialchars()
This might be a long shot, but since SOAP is XML based your quotes must be converted to XML entities somewhere.
I have no experience with nuSOAP, but a single quote's XML entity value is:
'
.Refer to the PHP function: htmlspecialchars()