【问题标题】:Sending message with special chars to pubnub server throw php sdk将带有特殊字符的消息发送到 pubnub 服务器 throw php sdk
【发布时间】:2015-03-15 00:20:15
【问题描述】:

问题:当我从 php 向 pubnub 发送消息时:

$msg = array("author"=>"MisterX","text"=>"Who's here?"); 
$pubnub = new Pubnub(PubNubPublishKey,PubNubSubscribeKey,PubNubSecretKey);
$publish_result = $pubnub->publish('chat1',$msg);

客户端(在 JS SDK 上)收到这样的消息:

MisterX:谁在这里?

但是当客户端从 JS 发送相同的消息时,它工作正常:

MisterX:谁在这里?

这是 PubNub PHP SDK 中的错误吗?也许我需要在放入publish() 之前使用$msg 进行额外的操作,但文档中没有提及。

【问题讨论】:

    标签: php escaping pubnub


    【解决方案1】:

    测试一下

    $msg = array("author"=>"MisterX","text"=>"Who's here?"); 
    $pubnub = new Pubnub(PubNubPublishKey,PubNubSubscribeKey,PubNubSecretKey);
    $publish_result = $pubnub->publish('chat1',$msg);
    

    【讨论】:

    • 我在真正的应用程序上有相同的代码。 " for text 键仅在 StackOverflow 上丢失。(现已修复)
    猜你喜欢
    • 1970-01-01
    • 2012-12-23
    • 2015-09-21
    • 2015-06-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多