search
Homephp教程php手册关于APNS的一些事(是以前的补充)

在之前也写过一些关于apns的事情,不过都没有深究。都是抄抄改改,写写弄弄,近日 在与人讨论时,人说纯中文可以发76个汉字左右。当时我就想了,这不应该

 在之前也写过一些关于apns的事情,不过都没有深究。都是抄抄改改,写写弄弄,近日 在与人讨论时,人说纯中文可以发76个汉字左右。当时我就想了,这不应该啊。apns总长度不能超过256字节,76个汉字。json_encode一下。一个汉字8个字节,早就超了不知道多少了。还要组成payload。。难道不超吗?

然后看了一下别人的函数,原来是用了一个自定义的json_encode。看了他的自定义json_encode之后,突然想起,风雪之隅在他的博客上提到过,5.4的json_encode加了一些参数(参考:让Json更懂中文(JSON_UNESCAPED_UNICODE)),于是看了一下。json_encode($str,JSON_UNESCAPED_UNICODE)。计算下来的长度与那个自定义的json_encode一样了。

自此,记录下来。推送的时候也可以多推几个汉字了。(仅限php5.4,之前的版本还是网上找自定义的json_encode函数吧,关键字:中文自定义 php json_encode ,或者直接看:http://yige.org/p/458)

早期关于APNS的文章 :

  • [2013-02-16] - 关于APNS的一些小问题 (浏览:698,评论:0)
  • [2013-02-07] - APNS 推送 (浏览:686,评论:0)
  • [2012-10-13] - 还是APNS的一些问题 (浏览:1232,评论:0)
  • [2012-07-18] - apns 二三事 (浏览:1371,评论:0)
  • [2012-07-17] - 关于APNS的一件挫事 (浏览:1494,评论:2)
  • [2012-04-17] - 供应商与苹果推送信息服务器通信 翻译苹果文档 (浏览:2172,评论:0)
  • [2012-04-17] - 苹果服务器反馈服务 (浏览:2820,评论:0)
  • [2012-04-17] - 苹果推送注意事项 (浏览:2893,评论:0)
  • [2011-12-07] - 伤不起的程序猿 (浏览:1866,评论:0)
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools