微信开发遇到的函数

typeof 获取变量类型

trim() 函数移除字符串两侧的空白字符或其他预定义字符

file_get_contents  把文件转换为输出字符串

 simplexml_load_string   把 XML 字符串载入对象中。如果失败,则返回 false。

<?php
$xmlstring = <<<XML
<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<to>George</to>
<from>John</from>
<heading>Reminder</heading>
<body>Don't forget the meeting!</body>
</note>
XML;

$xmlstring = <<<XML
<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<ToUserName><![CDATA[公众号]]></ToUserName>
<FromUserName><![CDATA[加密用户微信号]]></FromUserName>
<CreateTime>1348831860</CreateTime>
<MsgType><![CDATA[text]]></MsgType>
<Content><![CDATA[用户发送消息内容]]></Content>
<MsgId>1234567890123456</MsgId>
</note>
XML;

$xml = simplexml_load_string($xmlstring);

var_dump($xml);

SimpleXML 函数允许您把 XML 转换为对象。

$msgType = $xmlObj->MsgType;  输出解析XML对象的消息类型

sprintf() 函数把格式化的字符串写入变量中

memcache_init()

memcache_connect(IPD地址, 端口号);

json_encode()

memcache_set($mmc, $openID, $jsonStr, 0, 300);

memcache_get($mmc, $openID);

json_decode($jsonStr, true);

is_file()

原文地址:https://www.cnblogs.com/chenliuxiao/p/9368176.html