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

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor