<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>王国平博客</title><link>http://guopingblog.com/</link><description> 涉县网站建设 涉县seo 涉县网络公司 涉县网站推广</description><generator>RainbowSoft Studio Z-Blog 2.3 Avengers Build 180518</generator><language>zh-CN</language><pubDate>Thu, 19 Mar 2026 22:35:14 +0800</pubDate><item><title>Google Nexus7 2013 WIFI版刷机重新分区并安装lineageos(Android11)</title><author>851771362@qq.com (国平)</author><link>http://guopingblog.com/post/123.html</link><pubDate>Mon, 12 Aug 2024 17:19:49 +0800</pubDate><guid>http://guopingblog.com/post/123.html</guid><description><![CDATA[<p>免责声明：刷机有风险，变砖后果自负</p><p>注意！！！请按照教程步骤一步一步地操作且本教程仅适用于nexus7二代wifi版！</p><p>准备所需的软件：platform-tools、驱动文件（usb_driver_r13-windows.zip）、recovery文件（recovery.img）、rom文件（lineage-18.1-20240306-nightly-flox-signed.zip）、分区文件（flo-deb_clamor_repartition.zip）所有文件都在platform-tools文件夹已打包直接下载即可</p><p>链接：<a href="https://pan.quark.cn/s/e5c0cf4781ee">https://pan.quark.cn/s/e5c0cf4781ee</a>&nbsp; &nbsp;提取码：r2ZU</p><p>注意压缩包下载后直接解压即可用</p><p>第一步：先安装驱动文件</p><p>平板依次点开：设置-关于-找到版本号连续点击7次后会出现开发者选项点进去--打开usb调试</p><p>平板链接电脑后，找到压缩包里的usb_driver_r13-windows.zip 解压到桌面 然后依次点击：我的电脑（右键）--管理--设备管理器-- 在右边便携设备里能看到nexus7，右键更新驱动程序--浏览我的电脑以查找驱动程序(R)--让我从计算机上的可用驱动程序列表中选取(L)--显示所有设备--(Generic UsB Hub)--从磁盘安装--浏览--找到刚才解压到桌面的usb_driver驱动文件夹打开--Android Bootloader interface下一步即可。</p><p><img alt="微信截图_20240812180838.png" src="http://guopingblog.com/zb_users/upload/2024/8/2024081265399857.png" style="height:67px; width:0px" title="微信截图_20240812180838.png"/><img alt="" src="http://guopingblog.com/zb_users/upload/2024/8/20240812181357175717.png" style="height:238px; width:300px"/><img alt="" src="http://guopingblog.com/zb_users/upload/2024/8/20240812181334383438.png" style="height:247px; width:300px"/><img alt="" src="http://guopingblog.com/zb_users/upload/2024/8/20240812181364826482.png" style="height:236px; width:300px"/><img alt="" src="http://guopingblog.com/zb_users/upload/2024/8/20240812181481298129.png" style="height:181px; width:300px"/><img alt="" src="http://guopingblog.com/zb_users/upload/2024/8/20240812181414461446.png" style="height:220px; width:300px"/><img alt="" src="http://guopingblog.com/zb_users/upload/2024/8/20240812181497579757.png" style="height:143px; width:300px"/></p><p>第二步：</p><p>打开platform-tools 点击文件夹地址栏 输入cmd回车 打开cmd终端窗口</p><p>输入&nbsp;</p><pre class="brush:php;toolbar:false;">fastboot&nbsp;devices</pre><p>如果返回版本号说明驱动没问题链接成功，没有的话就是驱动安装的有问题。</p><p>第三步：输入</p><pre class="brush:php;toolbar:false;">adb&nbsp;reboot&nbsp;bootloader</pre><p>进入bootloader</p><p>第四步：输入</p><pre class="brush:php;toolbar:false;">fastboot&nbsp;oem&nbsp;unlock</pre><p>解锁bl锁&nbsp;注意：此时，设备可能会在屏幕上显示提示，需要手动选择yes才能继续解锁。</p><p><img alt="" src="http://guopingblog.com/zb_users/upload/2024/8/2024081218230291291.png" style="height:421px; width:293px"/><img alt="" src="http://guopingblog.com/zb_users/upload/2024/8/20240812182826382638.png" style="height:393px; width:313px"/></p><p>看到unlocked就说明解锁成功了。</p><p>第五步：输入</p><pre class="brush:php;toolbar:false;">fastboot&nbsp;boot&nbsp;recovery.img</pre><p>刷入临时启动recovery</p><p>第六步：在平板上依次点击 advanced --enble ADB开启调试</p><p>第七部：在电脑终端窗口先输入&nbsp;&nbsp;<span style="color:rgb(233, 30, 99); font-family:sfmono-regular,menlo,monaco,consolas,liberation mono,courier new,monospace; font-size:14px">adb -d shell 回车，然后依次输入以下命令（每次一行，输完回车）</span></p><pre class="brush:php;toolbar:false;">dd&nbsp;if=/dev/block/mmcblk0p2&nbsp;of=/sdcard/modemst1.img

dd&nbsp;if=/dev/block/mmcblk0p3&nbsp;of=/sdcard/modemst2.img

dd&nbsp;if=/dev/block/mmcblk0p4&nbsp;of=/sdcard/persist.img

exit</pre><p>第八步：<span style="color:rgb(233, 30, 99); font-family:sfmono-regular,menlo,monaco,consolas,liberation mono,courier new,monospace; font-size:14px">依次输入以下命令（每次一行，输完回车）</span></p><pre class="brush:php;toolbar:false;">adb&nbsp;-d&nbsp;pull&nbsp;/sdcard/modemst1.img

adb&nbsp;-d&nbsp;pull&nbsp;/sdcard/modemst2.img

adb&nbsp;-d&nbsp;pull&nbsp;/sdcard/persist.img</pre><p>第九步：在平板上依次点击 Apply update -- Apply from&nbsp;ADB</p><p>然后在电脑终端命令窗口输入</p><pre class="brush:php;toolbar:false;">adb&nbsp;-d&nbsp;sideload&nbsp;flo-deb_clamor_repartition.zip</pre><p>输入上面命令后注意看平板上需要手动选yes 等待进度100%了&nbsp;<span style="color:rgb(233, 30, 99); font-family:sfmono-regular,menlo,monaco,consolas,liberation mono,courier new,monospace; font-size:14px">依次输入以下命令（每次一行，输完回车）</span></p><pre class="prettyprint">adb&nbsp;-d&nbsp;shell

modify</pre><p>该设备将完成重新分区过程，请将其静置 10 分钟，当您返回时，屏幕上将显示类似以下内容：</p><pre class="brush:php;toolbar:false;">2048+0&nbsp;records&nbsp;in
2048+0&nbsp;records&nbsp;out
1048576&nbsp;bytes&nbsp;(1.0&nbsp;M)&nbsp;copied,&nbsp;0.106720&nbsp;s,&nbsp;9.3&nbsp;M/s
32768+0&nbsp;records&nbsp;in
32768+0&nbsp;records&nbsp;out
16777216&nbsp;bytes&nbsp;(16&nbsp;M)&nbsp;copied,&nbsp;0.546387&nbsp;s,&nbsp;29&nbsp;M/s</pre><p>等待大概10分钟后，先按平板的【电源键】大概5-10秒屏幕黑屏后松手，同时按平板的【电源键+音量-键】进入 【fastboot模式】 如下图：</p><p><img alt="" src="http://guopingblog.com/zb_users/upload/2024/8/20240812182826382638.png" style="height:393px; width:313px"/></p><p>第十步：输入</p><pre class="brush:php;toolbar:false;">fastboot&nbsp;-w</pre><p>格式化数据分区等待格式化完成</p><p>第十一步：输入</p><pre class="brush:php;toolbar:false;">fastboot&nbsp;flash&nbsp;recovery&nbsp;recovery.img</pre><p>重新刷入recovery</p><p>第十二步：双清，在平板上依次点击：</p><p>Factory reset -- Format data/factory reset 然后出现提示选择yes</p><p>Factory reset -- Format cache partition&nbsp;然后出现提示选择yes</p><p>完事后点击屏幕左上角返回箭头回到主页</p><p>第十三步：在平板上依次点击 Apply update --&nbsp;Apply from&nbsp;ADB&nbsp;</p><p>然后在电脑终端命令窗口输入</p><pre class="brush:php;toolbar:false;">adb&nbsp;sideload&nbsp;lineage-18.1-20240306-nightly-flox-signed.zip</pre><p>输入上面命令后注意看平板上需要手动选yes 等待电脑终端出现 <span style="color:#FF0000">Total xfer: 1.00x</span></p><p>单击平板屏幕左上角的后退箭头，然后单击Reboot system now</p><p>等待平板重启后进入系统设置就可以了。</p>]]></description><category>电脑技巧</category><comments>http://guopingblog.com/post/123.html#comment</comments><wfw:commentRss>http://guopingblog.com/feed.asp?cmt=123</wfw:commentRss></item><item><title>帝国cms同一篇文章采用索引链接方式发到两个栏目列表页避免重复调用方法</title><author>851771362@qq.com (国平)</author><link>http://guopingblog.com/post/122.html</link><pubDate>Wed, 08 May 2024 16:51:29 +0800</pubDate><guid>http://guopingblog.com/post/122.html</guid><description><![CDATA[<p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; border: 0px; font-family: &quot;Microsoft YaHei&quot;, Helvetica, Arial, &quot;Lucida Grande&quot;, Tahoma, sans-serif; font-size: 16px; margin-top: 15px; margin-bottom: 15px; padding: 0px; vertical-align: baseline; hyphens: auto; overflow-wrap: break-word; text-align: justify; text-indent: 2em; color: rgb(51, 51, 51); text-wrap: wrap; background-color: rgb(255, 255, 255);">帝国CMS发布文章如果需要将同一片文章发不到多个栏目需要用到“同时发布到以下栏目这个功能”，这个功能之前已经介绍过了可以参见以下文章：</p><p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; border: 0px; font-family: &quot;Microsoft YaHei&quot;, Helvetica, Arial, &quot;Lucida Grande&quot;, Tahoma, sans-serif; font-size: 16px; margin-top: 15px; margin-bottom: 15px; padding: 0px; vertical-align: baseline; hyphens: auto; overflow-wrap: break-word; text-align: justify; text-indent: 2em; color: rgb(51, 51, 51); text-wrap: wrap; background-color: rgb(255, 255, 255);">帝国CMS同一篇文章如何发表到多个栏目分类</p><p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; border: 0px; font-family: &quot;Microsoft YaHei&quot;, Helvetica, Arial, &quot;Lucida Grande&quot;, Tahoma, sans-serif; font-size: 16px; margin-top: 15px; margin-bottom: 15px; padding: 0px; vertical-align: baseline; hyphens: auto; overflow-wrap: break-word; text-align: justify; text-indent: 2em; color: rgb(51, 51, 51); text-wrap: wrap; background-color: rgb(255, 255, 255);">但这个功能在勾选“采用索引链接方式”以后，在相关文章调用的时候会出现重复调用的问题。</p><p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; border: 0px; font-family: &quot;Microsoft YaHei&quot;, Helvetica, Arial, &quot;Lucida Grande&quot;, Tahoma, sans-serif; font-size: 16px; margin-top: 15px; margin-bottom: 15px; padding: 0px; vertical-align: baseline; hyphens: auto; overflow-wrap: break-word; text-align: justify; text-indent: 2em; color: rgb(51, 51, 51); text-wrap: wrap; background-color: rgb(255, 255, 255);">方法如下:</p><p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; border: 0px; font-family: &quot;Microsoft YaHei&quot;, Helvetica, Arial, &quot;Lucida Grande&quot;, Tahoma, sans-serif; font-size: 16px; margin-top: 15px; margin-bottom: 15px; padding: 0px; vertical-align: baseline; hyphens: auto; overflow-wrap: break-word; text-align: justify; text-indent: 2em; color: rgb(51, 51, 51); text-wrap: wrap; background-color: rgb(255, 255, 255);">用到参数isurl=0，排除重复的链接 为1时说明文章地址为外部链接：</p><p style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; border: 0px; font-family: &quot;Microsoft YaHei&quot;, Helvetica, Arial, &quot;Lucida Grande&quot;, Tahoma, sans-serif; font-size: 16px; margin-top: 15px; margin-bottom: 15px; padding: 0px; vertical-align: baseline; hyphens: auto; overflow-wrap: break-word; text-align: justify; text-indent: 2em; color: rgb(51, 51, 51); text-wrap: wrap; background-color: rgb(255, 255, 255);">一、解决父级栏目列表页调用列表信息时，不调用采用索引链接同时发布的文章的方法：<br style="box-sizing: inherit; -webkit-tap-highlight-color: transparent;"/>列表模板修改，列表内容模板(list.var)这里的内容添加如下代码：（记得把“<span style="color: rgb(51, 51, 51); font-family: &quot;Microsoft YaHei&quot;, Helvetica, Arial, &quot;Lucida Grande&quot;, Tahoma, sans-serif; font-size: 16px; text-align: justify; text-indent: 32px; text-wrap: wrap; background-color: rgb(255, 255, 255);">使用程序代码</span>”勾上）</p><pre class="brush:php;toolbar:false">if($r[isurl]==&#39;0&#39;)
{
$list=&#39;&lt;li&gt;&lt;a&nbsp;href=&quot;[!--titleurl--]&quot;&nbsp;title=&quot;[!--oldtitle--]&quot;&gt;[!--title--]&lt;/a&gt;&nbsp;&lt;span&gt;[!--newstime--]&lt;/span&gt;&lt;/li&gt;&#39;;
}
$listtemp=$list;</pre><p><span style="color: rgb(51, 51, 51); font-family: &quot;Microsoft YaHei&quot;, Helvetica, Arial, &quot;Lucida Grande&quot;, Tahoma, sans-serif; font-size: 16px; text-align: justify; text-indent: 32px; text-wrap: wrap; background-color: rgb(255, 255, 255);">二、灵动标签、万能标签调用时可“附加SQL条件：” isurl=0</span><br style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; color: rgb(51, 51, 51); font-family: &quot;Microsoft YaHei&quot;, Helvetica, Arial, &quot;Lucida Grande&quot;, Tahoma, sans-serif; font-size: 16px; text-align: justify; text-indent: 32px; text-wrap: wrap; background-color: rgb(255, 255, 255);"/><span style="color: rgb(51, 51, 51); font-family: &quot;Microsoft YaHei&quot;, Helvetica, Arial, &quot;Lucida Grande&quot;, Tahoma, sans-serif; font-size: 16px; text-align: justify; text-indent: 32px; text-wrap: wrap; background-color: rgb(255, 255, 255);">如：万能标签 [ecmsinfo]0,11,28,0,3,2,0,&#39;isurl=0&#39;[/ecmsinfo]</span></p>]]></description><category>网络技术</category><comments>http://guopingblog.com/post/122.html#comment</comments><wfw:commentRss>http://guopingblog.com/feed.asp?cmt=122</wfw:commentRss></item><item><title>帝国cms英文版面包屑首页和分页显示英文</title><author>851771362@qq.com (国平)</author><link>http://guopingblog.com/post/121.html</link><pubDate>Thu, 28 Mar 2024 23:16:33 +0800</pubDate><guid>http://guopingblog.com/post/121.html</guid><description><![CDATA[<p>帝国cms做英文站面包屑导航首页显示的是汉字，需要将其改成英文 Home，方法如下：</p><p>找到&nbsp;/e/data/language/gb/pub/fun.php 文件</p><p>将&nbsp;&#39;index&#39;=&gt;&#39;首页&#39;,改成&#39;index&#39;=&gt;&#39;Home&#39;, 即可</p><p>分页可以自定义函数，然后在&nbsp;<span style="color: rgb(34, 34, 34); font-family: 微软雅黑, 宋体, &quot;Trebuchet MS&quot;, Tahoma, Arial, sans-serif; text-wrap: wrap; background-color: rgb(255, 255, 255);">e/class/userfun.php 调用对应函数即可</span></p><p>&#39;pripage&#39;=&gt;&#39;上一页&#39;,</p><p>&#39;pripage1&#39;=&gt;&#39;PRE&#39;,</p><p>&#39;nextpage&#39;=&gt;&#39;下一页&#39;,</p><p>&#39;nextpage1&#39;=&gt;&#39;NEXT&#39;,</p><p><br/></p><p>其他根据需求改</p><p><br/></p>]]></description><category>网络技术</category><comments>http://guopingblog.com/post/121.html#comment</comments><wfw:commentRss>http://guopingblog.com/feed.asp?cmt=121</wfw:commentRss></item><item><title>CentOS如何挂载硬盘</title><author>851771362@qq.com (国平)</author><link>http://guopingblog.com/post/120.html</link><pubDate>Thu, 12 Oct 2023 17:52:49 +0800</pubDate><guid>http://guopingblog.com/post/120.html</guid><description><![CDATA[<p data-first-child="" data-pid="LQj2sLyY" style="margin-top: 0px; margin-bottom: 1.4em;">在 CentOS 中挂载硬盘，可以按照以下步骤进行操作：</p><p class="ztext-empty-paragraph" style="margin-top: -0.8em; margin-bottom: -0.8em;">用SSH工具登录服务器</p><p data-pid="57aak2_m" style="margin-top: 1.4em; margin-bottom: 1.4em;">1. 确定要挂载的硬盘设备名，可以使用以下命令查看：</p><pre class="brush:php;toolbar:false">fdisk&nbsp;-l</pre><p><img src="http://guopingblog.com/zb_users/upload/2023/10/2023101265050849.png" width="566" height="273" title="cadbe4a0e131a8779a5753e5fb0e7471.png" alt="cadbe4a0e131a8779a5753e5fb0e7471.png"/></p><p>2. 创建一个用于挂载硬盘的目录，比如：data</p><pre class="brush:php;toolbar:false">mkdir&nbsp;/data</pre><p><span data-slate-fragment="JTVCJTdCJTIydHlwZSUyMiUzQSUyMnAlMjIlMkMlMjJjaGlsZHJlbiUyMiUzQSU1QiU3QiUyMnRleHQlMjIlM0ElMjIlRTYlODklQTclRTglQTElOEMlRTQlQkIlQTUlRTQlQjglOEIlRTUlOTElQkQlRTQlQkIlQTQlRUYlQkMlOEMlRTYlQTAlQkMlRTUlQkMlOEYlRTUlOEMlOTYlRTglQUYlQTUlRTclQTMlODElRTclOUIlOTglRTMlODAlODIlMjIlN0QlNUQlN0QlNUQ=" style="white-space-collapse: preserve;"><span style="text-wrap: wrap;">3. </span>执行以下命令，格式化该磁盘。</span></p><pre class="brush:php;toolbar:false">mkfs.ext4&nbsp;/dev/vdb</pre><p>4. 执行以下命令，将硬盘挂载到目录 /data：</p><pre class="brush:php;toolbar:false">mount&nbsp;/dev/vdb&nbsp;/data</pre><p>其中，/dev/vdb 是要挂载的硬盘设备名，/data 是挂载目录。</p><p>5. 设置每次系统启动后都自动挂载，执行以下命令，使用 VI 编辑器打开 /etc/fstab 文件。</p><pre class="brush:php;toolbar:false">vi&nbsp;/etc/fstab</pre><p><span style="text-wrap: wrap;">6.&nbsp;</span>按<span style="color: rgb(255, 0, 0);"> i </span>进入编辑模式。</p><p><span style="text-wrap: wrap;">7.&nbsp;</span>将光标移至文件末尾，按 Enter，添加如下内容。</p><pre class="brush:php;toolbar:false">&nbsp;/dev/vdb&nbsp;/data&nbsp;ext4&nbsp;defaults&nbsp;0&nbsp;0</pre><p><span style="text-wrap: wrap;">8.&nbsp;</span>按 <span style="color: rgb(255, 0, 0);">Esc</span>，输入 <span style="color: rgb(255, 0, 0);">:wq</span>，按 <span style="color: rgb(255, 0, 0);">Enter</span>。保存设置并退出编辑器。</p><p><br/></p><p>重启服务器，输入<span style="color: rgb(255, 0, 0);"> df </span>查看是否挂载成功。</p><p><br/></p><p><br/></p><p><br/></p><p><br/></p>]]></description><category>网络技术</category><comments>http://guopingblog.com/post/120.html#comment</comments><wfw:commentRss>http://guopingblog.com/feed.asp?cmt=120</wfw:commentRss></item><item><title>网站cookie未设置Httponly标识漏洞修复</title><author>851771362@qq.com (国平)</author><link>http://guopingblog.com/post/119.html</link><pubDate>Sun, 10 Sep 2023 21:23:09 +0800</pubDate><guid>http://guopingblog.com/post/119.html</guid><description><![CDATA[<p>打开PHP文件搜索&nbsp;<span style="text-wrap: wrap;">session.cookie_secure&nbsp; 和&nbsp;<span style="text-wrap: wrap;">session.cookie_httponly 改成下面的就可以了，</span></span></p><pre class="brush:php;toolbar:false">session.cookie_secure&nbsp;=&nbsp;1
session.cookie_httponly&nbsp;=&nbsp;1</pre><p><span style="text-wrap: wrap;">记得把前面的冒号去掉，修改完重启PHP服务即可。</span></p>]]></description><category>网络技术</category><comments>http://guopingblog.com/post/119.html#comment</comments><wfw:commentRss>http://guopingblog.com/feed.asp?cmt=119</wfw:commentRss></item><item><title>PHPMPS缓存信息点击量，避免频繁更新数据库的方法</title><author>851771362@qq.com (国平)</author><link>http://guopingblog.com/post/118.html</link><pubDate>Sun, 20 Aug 2023 22:08:11 +0800</pubDate><guid>http://guopingblog.com/post/118.html</guid><description><![CDATA[<p>第一步：在global.fun.php文件中自定义两个函数</p><pre class="brush:php;toolbar:false">//缓存点击量
function&nbsp;cache_hits($module,&nbsp;$itemid)&nbsp;{
	if(@$fp&nbsp;=&nbsp;fopen(PHPMPS_CACHE.&#39;/hits-&#39;.$module.&#39;.php&#39;,&nbsp;&#39;a&#39;))&nbsp;{
		flock($fp,&nbsp;LOCK_EX);
		fwrite($fp,&nbsp;$itemid.&#39;&nbsp;&#39;);
		flock($fp,&nbsp;LOCK_UN);
		fclose($fp);
	}
}
//更新点击量
function&nbsp;update_hits($module,&nbsp;$table)&nbsp;{
	global&nbsp;$db;
	$hits&nbsp;=&nbsp;trim(file_get(PHPMPS_CACHE.&#39;/hits-&#39;.$module.&#39;.php&#39;));
	file_put(PHPMPS_CACHE.&#39;/hits-&#39;.$module.&#39;.php&#39;,&nbsp;&#39;&nbsp;&#39;);
	file_put(PHPMPS_CACHE.&#39;/hits-&#39;.$module.&#39;.dat&#39;,&nbsp;time());
	if($hits)&nbsp;{
		$tmp&nbsp;=&nbsp;array_count_values(explode(&#39;&nbsp;&#39;,&nbsp;$hits));
		$arr&nbsp;=&nbsp;array();
		foreach($tmp&nbsp;as&nbsp;$k=&gt;$v)&nbsp;{
			$arr[$v]&nbsp;.=&nbsp;$k&nbsp;?&nbsp;&#39;,&#39;.$k&nbsp;:&nbsp;&#39;&#39;;
		}
		$id&nbsp;=&nbsp;$module&nbsp;==&nbsp;&#39;info&#39;&nbsp;?&nbsp;&#39;id&#39;&nbsp;:&nbsp;&#39;comid&#39;;
		foreach($arr&nbsp;as&nbsp;$k=&gt;$v)&nbsp;{
			$db-&gt;query(&quot;UPDATE&nbsp;LOW_PRIORITY&nbsp;{$table}&nbsp;SET&nbsp;`click`=`click`+&quot;.$k.&quot;&nbsp;WHERE&nbsp;`$id`&nbsp;IN&nbsp;(0&quot;.$v.&quot;)&quot;,&nbsp;&#39;UNBUFFERED&#39;);
		}
	}
}</pre><p>第二步：在common.php文件中添加下面代码</p><pre class="brush:php;toolbar:false">$PHP_TIME&nbsp;=&nbsp;$PHPMPS_TIME&nbsp;=&nbsp;time();&nbsp;//定义时间

define(&#39;SYS_WIN&#39;,&nbsp;strpos(strtoupper(PHP_OS),&nbsp;&#39;WIN&#39;)&nbsp;!==&nbsp;false&nbsp;?&nbsp;true:&nbsp;false);//获取当前操作系统
define(&#39;PHPMPS_CACHE&#39;,&nbsp;PHPMPS_ROOT.&#39;data/phpcache&#39;);&nbsp;&nbsp;//定义缓存路径
define(&#39;P_CHMOD&#39;,&nbsp;($CFG[&#39;file_mod&#39;]&nbsp;&amp;&amp;&nbsp;!SYS_WIN)&nbsp;?&nbsp;$CFG[&#39;file_mod&#39;]&nbsp;:&nbsp;0);//文件目录权限修改</pre><p>第三步：在数据库phpmps_config表里添加一个字段 <span style="color: rgb(255, 0, 0);">cache_hits</span>&nbsp;然后在后台系统配置模板里加上这个参数，用来设置缓存时间。（<span style="text-wrap: wrap;">以秒为单位</span>）</p><p><br/></p><p>第四步：把view.php文件中原来更新点击量的代码</p><pre class="brush:php;toolbar:false">$db-&gt;query(&quot;UPDATE&nbsp;{$table}info&nbsp;SET&nbsp;click=click+1&nbsp;WHERE&nbsp;id=&#39;$id&#39;&quot;);</pre><p><span style="text-wrap: wrap;"></span>换成下面的代码</p><pre class="brush:php;toolbar:false">//点击量缓存
if($CFG[&#39;cache_hits&#39;])&nbsp;{
	&nbsp;cache_hits(&#39;info&#39;,&nbsp;$id);
}&nbsp;else&nbsp;{
	$db-&gt;query(&quot;UPDATE&nbsp;LOW_PRIORITY&nbsp;{$table}info&nbsp;SET&nbsp;click=click+1&nbsp;WHERE&nbsp;id=&#39;$id&#39;&quot;);
}</pre><p><span style="text-wrap: wrap;">第五步：在category.php文件中添加下面代码</span></p><pre class="brush:php;toolbar:false">//更新点击量缓存
if($CFG[&#39;cache_hits&#39;])&nbsp;{
	$file&nbsp;=&nbsp;PHPMPS_CACHE.&#39;/hits-info&#39;;
	if($PHPMPS_TIME&nbsp;-&nbsp;@filemtime($file.&#39;.dat&#39;)&nbsp;&gt;&nbsp;$CFG[&#39;cache_hits&#39;]&nbsp;||&nbsp;@filesize($file.&#39;.php&#39;)&nbsp;&gt;&nbsp;102400)&nbsp;update_hits(&#39;info&#39;,&nbsp;$table.&#39;info&#39;);
}</pre><p><span style="text-wrap: wrap;"></span>搞完后在后台系统设置里设置好缓存时间，这样信息点击量会被先缓存到hits-info.php缓存文件里然后按照设置好的缓存时间再更新到数据库，有效缓解数据库的压力！</p><p>同理商家页点击量也可以这么设置，将第四<span style="text-wrap: wrap;">步&nbsp;<span style="text-wrap: wrap; color: rgb(255, 0, 0);">cache_hits(&#39;info&#39;, $id); </span>改成&nbsp;<span style="text-wrap: wrap; color: rgb(255, 0, 0);">cache_hits(&#39;com&#39;, $comid);</span></span></p>]]></description><category>网络技术</category><comments>http://guopingblog.com/post/118.html#comment</comments><wfw:commentRss>http://guopingblog.com/feed.asp?cmt=118</wfw:commentRss></item><item><title>PHP同时获取IPV4和IPV6</title><author>851771362@qq.com (国平)</author><link>http://guopingblog.com/post/117.html</link><pubDate>Wed, 26 Jul 2023 10:49:45 +0800</pubDate><guid>http://guopingblog.com/post/117.html</guid><description><![CDATA[<p>PHP获取IPV6并存到数据库</p><p><br/></p><p>第一步：在数据添加一个字段 类型&nbsp;varchar()&nbsp; &nbsp; 长度50</p><p><br/></p><p>第二步：定义函数（仅限PHP5.6）</p><pre class="brush:php;toolbar:false">function&nbsp;get_ip()
{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;static&nbsp;$ip&nbsp;=&nbsp;NULL;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if($ip&nbsp;!==&nbsp;NULL){return&nbsp;$ip;}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(getenv(&#39;HTTP_CLIENT_IP&#39;)&nbsp;&amp;&amp;&nbsp;strcasecmp(getenv(&#39;HTTP_CLIENT_IP&#39;),&nbsp;&#39;unknown&#39;))&nbsp;{

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ip&nbsp;=&nbsp;getenv(&#39;HTTP_CLIENT_IP&#39;);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elseif(getenv(&#39;HTTP_X_FORWARDED_FOR&#39;)&nbsp;&amp;&amp;&nbsp;strcasecmp(getenv(&#39;HTTP_X_FORWARDED_FOR&#39;),&nbsp;&#39;unknown&#39;)){

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ip&nbsp;=&nbsp;getenv(&#39;HTTP_X_FORWARDED_FOR&#39;);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elseif(getenv(&#39;REMOTE_ADDR&#39;)&nbsp;&amp;&amp;&nbsp;strcasecmp(getenv(&#39;REMOTE_ADDR&#39;),&nbsp;&#39;unknown&#39;)){

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ip&nbsp;=&nbsp;getenv(&#39;REMOTE_ADDR&#39;);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elseif(isset($_SERVER[&#39;REMOTE_ADDR&#39;])&nbsp;&amp;&amp;&nbsp;$_SERVER[&#39;REMOTE_ADDR&#39;]&nbsp;&amp;&amp;&nbsp;strcasecmp($_SERVER[&#39;REMOTE_ADDR&#39;],&nbsp;&#39;unknown&#39;)){

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ip&nbsp;=&nbsp;$_SERVER[&#39;REMOTE_ADDR&#39;];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;(substr_count($ip,&nbsp;&#39;:&#39;)&nbsp;&gt;&nbsp;1&nbsp;&amp;&amp;&nbsp;false&nbsp;!==&nbsp;filter_var($ip,&nbsp;FILTER_VALIDATE_IP,&nbsp;FILTER_FLAG_IPV6))&nbsp;||&nbsp;false&nbsp;!==&nbsp;filter_var($ip,&nbsp;FILTER_VALIDATE_IP,&nbsp;FILTER_FLAG_IPV4)&nbsp;?&nbsp;$ip&nbsp;:&nbsp;&#39;0.0.0.0&#39;;
}</pre><p>&nbsp;然后调用&nbsp;get_ip() 这个函数就可以了</p><p><br/></p><p>&nbsp;PHP7.4以上用这个</p><pre class="brush:php;toolbar:false">function&nbsp;egetip():&nbsp;string
{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(getenv(&#39;HTTP_CLIENT_IP&#39;)&nbsp;&amp;&amp;&nbsp;strcasecmp(getenv(&#39;HTTP_CLIENT_IP&#39;),&nbsp;&#39;unknown&#39;))&nbsp;{

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ip&nbsp;=&nbsp;getenv(&#39;HTTP_CLIENT_IP&#39;);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elseif(getenv(&#39;HTTP_X_FORWARDED_FOR&#39;)&nbsp;&amp;&amp;&nbsp;strcasecmp(getenv(&#39;HTTP_X_FORWARDED_FOR&#39;),&nbsp;&#39;unknown&#39;)){

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ip&nbsp;=&nbsp;getenv(&#39;HTTP_X_FORWARDED_FOR&#39;);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elseif(getenv(&#39;REMOTE_ADDR&#39;)&nbsp;&amp;&amp;&nbsp;strcasecmp(getenv(&#39;REMOTE_ADDR&#39;),&nbsp;&#39;unknown&#39;)){

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ip&nbsp;=&nbsp;getenv(&#39;REMOTE_ADDR&#39;);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elseif(isset($_SERVER[&#39;REMOTE_ADDR&#39;])&nbsp;&amp;&amp;&nbsp;$_SERVER[&#39;REMOTE_ADDR&#39;]&nbsp;&amp;&amp;&nbsp;strcasecmp($_SERVER[&#39;REMOTE_ADDR&#39;],&nbsp;&#39;unknown&#39;)){

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ip&nbsp;=&nbsp;$_SERVER[&#39;REMOTE_ADDR&#39;];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;(substr_count($ip,&nbsp;&#39;:&#39;)&nbsp;&gt;&nbsp;1&nbsp;&amp;&amp;&nbsp;false&nbsp;!==&nbsp;filter_var($ip,&nbsp;FILTER_VALIDATE_IP,&nbsp;FILTER_FLAG_IPV6))&nbsp;||&nbsp;false&nbsp;!==&nbsp;filter_var($ip,&nbsp;FILTER_VALIDATE_IP,&nbsp;FILTER_FLAG_IPV4)&nbsp;?&nbsp;$ip&nbsp;:&nbsp;&#39;0.0.0.0&#39;;
}</pre><p><br/></p>]]></description><category>网络技术</category><comments>http://guopingblog.com/post/117.html#comment</comments><wfw:commentRss>http://guopingblog.com/feed.asp?cmt=117</wfw:commentRss></item><item><title>批量下载图片,且按原始目录进行保存的方法</title><author>851771362@qq.com (国平)</author><link>http://guopingblog.com/post/115.html</link><pubDate>Tue, 25 Jul 2023 20:56:22 +0800</pubDate><guid>http://guopingblog.com/post/115.html</guid><description><![CDATA[<p>最近把网站精简一下，没用的图片都删掉，不会写程序，想了个变通的方法，直接从数据库把图片的表导出cvs，表里是图片地址，那么就需要根据这些地址<span style="text-wrap: wrap;">批量下载图片,且按原始目录进行保存，<span style="text-wrap: wrap;">比如1.jpg下载时自动识别并生成链接中的a文件夹和b子文件夹，1.jpg自动放入b文件夹中。</span></span></p><p>为了给服务器减负把整站down下来，在本地搭建了一套网站，这样会更快一些！说一下方法：</p><p><strong>第一步：安装wget</strong></p><p>1、下载wget&nbsp; 地址： <a href="https://eternallybored.org/misc/wget/" _src="https://eternallybored.org/misc/wget/">https://eternallybored.org/misc/wget/</a>&nbsp; &nbsp; &nbsp;根据自己的操作系统下载</p><p><img src="http://guopingblog.com/zb_users/upload/2023/7/2023072575968713.png" width="879" height="530" title="微信截图_20230725210548.png" alt="微信截图_20230725210548.png" style="width: 463px; height: 316px;"/></p><p><br/></p><p>2、将下载好的wget.exe放到 C:/windows/system32&nbsp; 文件夹下</p><p><br/></p><p>3、在cmd中输入&nbsp; wget --version&nbsp; &nbsp;有如下输出表示安装成功</p><p><img src="http://guopingblog.com/zb_users/upload/2023/7/2023072576476545.jpg" width="800" height="418" title="微信截图_20230725210751_副本.jpg" alt="微信截图_20230725210751_副本.jpg" style="width: 622px; height: 303px;"/></p><p><br/></p><p><strong>第二步：在D盘新建&nbsp;<span style="text-wrap: wrap;">download.txt ，</span>把要下载的图片链接放到&nbsp;<span style="text-wrap: wrap;">download.txt 文件里，一行一个图片地址</span></strong></p><p><strong><span style="text-wrap: wrap;"><br/></span></strong></p><p><strong><span style="text-wrap: wrap;">第三步：在 cmd 中输入&nbsp;<span style="text-wrap: wrap;">wget -nc -r -i D:\download.txt</span></span></strong></p><p><br/></p><p>等着完成就可以了，下载的图片保存在&nbsp;<span style="color: rgb(192, 0, 0);">&nbsp;<span style="text-wrap: wrap;">C:\Users\用户名\下载链接域名文件夹下</span></span></p><p><br/></p><p><br/></p><p><br/></p><p><br/></p><p><br/></p>]]></description><category>网络技术</category><comments>http://guopingblog.com/post/115.html#comment</comments><wfw:commentRss>http://guopingblog.com/feed.asp?cmt=115</wfw:commentRss></item><item><title>小程序webview页面分享后打开分享页面</title><author>851771362@qq.com (国平)</author><link>http://guopingblog.com/post/114.html</link><pubDate>Tue, 11 Jul 2023 21:07:05 +0800</pubDate><guid>http://guopingblog.com/post/114.html</guid><description><![CDATA[<p>在用微信小程序webview打包网站的时候遇到个问题，直接打包的网站详情页分享给朋友后，朋友打开的还是首页，而不是详情页。<br/></p><p>今天就来分享一下H5页面通过<span style="text-wrap: wrap;">微信小程序</span>webview打包成小程序后，小程序页面分享出去后，别人打开仍然显示你分享时候的页面，并且显示分享页面title和简介的实现方法。</p><p><br/></p><p>第一步：先用微信开发者工具新建一个小程序，默认会有index文件夹，打开index文件夹下的 index.wxml 文件放入下面的代码：</p><pre class="brush:html;toolbar:false;">&lt;web-view&nbsp;class=&#39;page_web&#39;&nbsp;src=&quot;{{url}}&quot;&nbsp;bindmessage=&quot;bindGetMsg&quot;&gt;&lt;/web-view&gt;</pre><p>第二步：打开<span style="text-wrap: wrap;">index文件夹下的&nbsp;</span><span style="text-wrap: wrap;">index.js 文件放入下面的代码：</span></p><pre class="brush:html;toolbar:false">Page({
&nbsp;&nbsp;data:&nbsp;{
&nbsp;&nbsp;url:&nbsp;&#39;改成自己的网站链接如：https://www.abcxxx.com&#39;&nbsp;&nbsp;&nbsp;//h5地址
&nbsp;&nbsp;},
&nbsp;&nbsp;bindmessage(e)&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//接收web-view传递的参数
&nbsp;&nbsp;if&nbsp;(e.detail.data[e.detail.data&nbsp;-&nbsp;1].title)&nbsp;{
&nbsp;&nbsp;this.setData({&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//存储状态
&nbsp;&nbsp;title:&nbsp;e.detail.data[0].title
&nbsp;&nbsp;})
&nbsp;&nbsp;}
&nbsp;&nbsp;},
&nbsp;&nbsp;
&nbsp;&nbsp;//分享功能部分代码
&nbsp;&nbsp;onLoad:&nbsp;function&nbsp;(options)&nbsp;{
&nbsp;&nbsp;options.url&nbsp;?&nbsp;this.setData({&nbsp;url:&nbsp;decodeURIComponent(options.url)&nbsp;})&nbsp;:&nbsp;this.setData({&nbsp;url:&nbsp;options.url&nbsp;});
&nbsp;&nbsp;},
&nbsp;&nbsp;
&nbsp;&nbsp;//获取网页标题&nbsp;&nbsp;
&nbsp;&nbsp;bindGetMsg:&nbsp;function&nbsp;(e)&nbsp;{
&nbsp;&nbsp;this.data.shareObj&nbsp;=&nbsp;e.detail.data[e.detail.data.length&nbsp;-&nbsp;1];
&nbsp;&nbsp;},
&nbsp;&nbsp;
&nbsp;&nbsp;//分享并返回页面标题和链接&nbsp;&nbsp;
&nbsp;&nbsp;onShareAppMessage:&nbsp;function&nbsp;(options)&nbsp;{
&nbsp;&nbsp;let&nbsp;shareObj&nbsp;=&nbsp;this.data.shareObj;
&nbsp;&nbsp;if&nbsp;(shareObj)&nbsp;{
&nbsp;&nbsp;return&nbsp;{
&nbsp;&nbsp;title:&nbsp;shareObj.shareTitle,
&nbsp;&nbsp;desc:&nbsp;shareObj.shareDesc,
&nbsp;&nbsp;path:&nbsp;&#39;/pages/index/index?url=&#39;&nbsp;+&nbsp;encodeURIComponent(options.webViewUrl),
&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;},
})</pre><p><span style="text-wrap: wrap;">第三步：在网站H5页面放入</span><span style="text-wrap: wrap;">下面的代码：</span></p><pre class="brush:js;toolbar:false">&lt;script&nbsp;type=&quot;text/javascript&quot;&nbsp;src=&quot;https://res.wx.qq.com/open/js/jweixin-1.3.2.js&quot;&gt;&lt;/script&gt;&nbsp;
&lt;script&nbsp;type=&quot;text/javascript&quot;&gt;
var&nbsp;obj&nbsp;=&nbsp;{
&#39;shareDesc&#39;:&nbsp;&#39;{你的网站description调用变量}&#39;,
&#39;shareTitle&#39;:&nbsp;&#39;{你的网站Title调用变量}&#39;
}
wx.miniProgram.postMessage({
data:&nbsp;obj
})
console.log(getUrlkey_(window.location.href))
&lt;/script&gt;</pre><p><span style="text-wrap: wrap;"></span>OK，<span style="text-wrap: wrap;">可以现在微信开发者工具里本地预览看下</span>试试，没问题的话直接打包提交小程序，审核上线就可以了。</p>]]></description><category>网络技术</category><comments>http://guopingblog.com/post/114.html#comment</comments><wfw:commentRss>http://guopingblog.com/feed.asp?cmt=114</wfw:commentRss></item><item><title>微信分享网页链接带图标和摘要的方法</title><author>851771362@qq.com (国平)</author><link>http://guopingblog.com/post/113.html</link><pubDate>Tue, 11 Jul 2023 20:44:28 +0800</pubDate><guid>http://guopingblog.com/post/113.html</guid><description><![CDATA[<p>首先你<strong>必须有一个微信公众号</strong>，然后把你的网站ip地址输入公众号ip白名单。</p><p>步骤一：验证文件并且绑定域名</p><p>先登录微信公众平台进入“公众号设置”的“功能设置”里填写“JS接口安全域名”。</p><p>步骤二：在要分享的页面引入JS文件</p><pre class="brush:html;toolbar:false">&lt;script&nbsp;src=&quot;http://res.wx.qq.com/open/js/jweixin-1.2.0.js&quot;&gt;&lt;/script&gt;
&lt;script&gt;
&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;&nbsp;url=location.href;
&nbsp;&nbsp;&nbsp;&nbsp;$.ajax({
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type&nbsp;:&nbsp;&quot;get&quot;,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//这里是放在根目录如新建文件夹则url：&quot;https://这里改为你自己的网址.com/文件夹名/jssdk.php?url=&quot;+url
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;url&nbsp;:&nbsp;&quot;https://这里改为你自己的网址.com/wx/jssdk.php?url=&quot;+encodeURIComponent(url),
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dataType&nbsp;:&nbsp;&quot;jsonp&quot;,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;jsonp:&nbsp;&quot;callback&quot;,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;jsonpCallback:&quot;success_jsonpCallback&quot;,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;success&nbsp;:&nbsp;function(data){
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wx.config({
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;debug:&nbsp;false,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;appId:&nbsp;data.appId,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;timestamp:&nbsp;data.timestamp,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nonceStr:&nbsp;data.nonceStr,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;signature:&nbsp;data.signature,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;jsApiList:&nbsp;[
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#39;onMenuShareTimeline&#39;,//
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#39;onMenuShareAppMessage&#39;,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#39;onMenuShareQQ&#39;,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#39;onMenuShareWeibo&#39;,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#39;onMenuShareQZone&#39;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;error:function(data){
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert(&quot;连接失败！&quot;);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;});
&nbsp;&nbsp;&nbsp;&nbsp;wx.ready(function&nbsp;()&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;shareData&nbsp;=&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;title:&nbsp;&#39;这是是分享标题&#39;,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;desc:&nbsp;&#39;这是是摘要&#39;,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;link:&nbsp;url,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;imgUrl:&nbsp;&#39;这里改为你网站域名下的小图标文件的地址&#39;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;};
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wx.onMenuShareAppMessage(shareData);//分享给好友
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wx.onMenuShareTimeline(shareData);//分享到朋友圈
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wx.onMenuShareQQ(shareData);//分享给手机QQ
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wx.onMenuShareWeibo(shareData);//分享腾讯微博
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wx.onMenuShareQZone(shareData);//分享到QQ空间
&nbsp;&nbsp;&nbsp;&nbsp;});
&nbsp;&nbsp;&nbsp;&nbsp;wx.error(function&nbsp;(res)&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//alert(res.errMsg);//错误提示
&nbsp;&nbsp;&nbsp;&nbsp;});
&lt;/script&gt;</pre><p>url : &quot;https://这里改为你自己的网址.com/wx/jssdk.php?url=&quot;+url,</p><p><strong>这个网站不必须是目前的网址，如果你有多个网站，可以引用同一个jssdk.php文件。</strong></p><p><strong><br/></strong></p><p>步骤三：创建PHP文件&nbsp; &nbsp;jssdk.php（对于jssdk.php文件我们可以直接放根目录，也可新建文件夹，这里我们放在根目录/wx/文件夹下面）</p><pre class="brush:php;toolbar:false">&lt;?php
&nbsp;$url&nbsp;=&nbsp;$_GET[&#39;url&#39;];
class&nbsp;JSSDK&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;$appId;
&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;$appSecret;
&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;$url;
&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;__construct($appId,&nbsp;$appSecret,$url)&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;appId&nbsp;=&nbsp;$appId;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;appSecret&nbsp;=&nbsp;$appSecret;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;url&nbsp;=&nbsp;$url;
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;getSignPackage()&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$jsapiTicket&nbsp;=&nbsp;$this-&gt;getJsApiTicket();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$protocol&nbsp;=&nbsp;(!empty($_SERVER[&#39;HTTPS&#39;])&nbsp;&amp;&amp;&nbsp;$_SERVER[&#39;HTTPS&#39;]&nbsp;!==&nbsp;&#39;off&#39;&nbsp;||&nbsp;$_SERVER[&#39;SERVER_PORT&#39;]&nbsp;==&nbsp;443)&nbsp;?&nbsp;&quot;https://&quot;&nbsp;:&nbsp;&quot;http://&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;$url&nbsp;=&nbsp;&quot;$protocol$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$url&nbsp;=$this-&gt;url;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$timestamp&nbsp;=&nbsp;time();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$nonceStr&nbsp;=&nbsp;$this-&gt;createNonceStr();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;这里参数的顺序要按照&nbsp;key&nbsp;值&nbsp;ASCII&nbsp;码升序排序
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$string&nbsp;=&nbsp;&quot;jsapi_ticket=$jsapiTicket&amp;noncestr=$nonceStr&amp;timestamp=$timestamp&amp;url=$url&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$signature&nbsp;=&nbsp;sha1($string);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$signPackage&nbsp;=&nbsp;array(
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;appId&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt;&nbsp;$this-&gt;appId,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;nonceStr&quot;&nbsp;&nbsp;=&gt;&nbsp;$nonceStr,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;timestamp&quot;&nbsp;=&gt;&nbsp;$timestamp,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;url&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt;&nbsp;$url,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;signature&quot;&nbsp;=&gt;&nbsp;$signature,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;rawString&quot;&nbsp;=&gt;&nbsp;$string
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$signPackage;
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;function&nbsp;createNonceStr($length&nbsp;=&nbsp;16)&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$chars&nbsp;=&nbsp;&quot;abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$str&nbsp;=&nbsp;&quot;&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;($i&nbsp;=&nbsp;0;&nbsp;$i&nbsp;&lt;&nbsp;$length;&nbsp;$i++)&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$str&nbsp;.=&nbsp;substr($chars,&nbsp;mt_rand(0,&nbsp;strlen($chars)&nbsp;-&nbsp;1),&nbsp;1);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$str;
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;function&nbsp;getJsApiTicket()&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;jsapi_ticket&nbsp;应该全局存储与更新，以下代码以写入到文件中做示例
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$data&nbsp;=&nbsp;json_decode(file_get_contents(&quot;jsapi_ticket.json&quot;));
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($data-&gt;expire_time&nbsp;&lt;&nbsp;time())&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$accessToken&nbsp;=&nbsp;$this-&gt;getAccessToken();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;如果是企业号用以下&nbsp;URL&nbsp;获取&nbsp;ticket
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;$url&nbsp;=&nbsp;&quot;https://qyapi.weixin.qq.com/cgi-bin/get_jsapi_ticket?access_token=$accessToken&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$url&nbsp;=&nbsp;&quot;https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=jsapi&amp;access_token=$accessToken&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$res&nbsp;=&nbsp;json_decode($this-&gt;httpGet($url));
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ticket&nbsp;=&nbsp;$res-&gt;ticket;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($ticket)&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$data-&gt;expire_time&nbsp;=&nbsp;time()&nbsp;+&nbsp;7000;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$data-&gt;jsapi_ticket&nbsp;=&nbsp;$ticket;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$fp&nbsp;=&nbsp;fopen(&quot;jsapi_ticket.json&quot;,&nbsp;&quot;w&quot;);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fwrite($fp,&nbsp;json_encode($data));
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fclose($fp);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ticket&nbsp;=&nbsp;$data-&gt;jsapi_ticket;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$ticket;
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;function&nbsp;getAccessToken()&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;access_token&nbsp;应该全局存储与更新，以下代码以写入到文件中做示例
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$data&nbsp;=&nbsp;json_decode(file_get_contents(&quot;access_token.json&quot;));
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($data-&gt;expire_time&nbsp;&lt;&nbsp;time())&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;如果是企业号用以下URL获取access_token
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;$url&nbsp;=&nbsp;&quot;https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=$this-&gt;appId&amp;corpsecret=$this-&gt;appSecret&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$url&nbsp;=&nbsp;&quot;https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&amp;appid=$this-&gt;appId&amp;secret=$this-&gt;appSecret&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$res&nbsp;=&nbsp;json_decode($this-&gt;httpGet($url));
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$access_token&nbsp;=&nbsp;$res-&gt;access_token;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($access_token)&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$data-&gt;expire_time&nbsp;=&nbsp;time()&nbsp;+&nbsp;7000;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$data-&gt;access_token&nbsp;=&nbsp;$access_token;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$fp&nbsp;=&nbsp;fopen(&quot;access_token.json&quot;,&nbsp;&quot;w&quot;);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fwrite($fp,&nbsp;json_encode($data));
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fclose($fp);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$access_token&nbsp;=&nbsp;$data-&gt;access_token;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$access_token;
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;function&nbsp;httpGet($url)&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$curl&nbsp;=&nbsp;curl_init();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;curl_setopt($curl,&nbsp;CURLOPT_RETURNTRANSFER,&nbsp;true);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;curl_setopt($curl,&nbsp;CURLOPT_TIMEOUT,&nbsp;500);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;curl_setopt($curl,&nbsp;CURLOPT_SSL_VERIFYPEER,&nbsp;false);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;curl_setopt($curl,&nbsp;CURLOPT_SSL_VERIFYHOST,&nbsp;false);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;curl_setopt($curl,&nbsp;CURLOPT_URL,&nbsp;$url);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$res&nbsp;=&nbsp;curl_exec($curl);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;curl_close($curl);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;$res;
&nbsp;&nbsp;&nbsp;&nbsp;}
}
&nbsp;
$jssdk&nbsp;=&nbsp;new&nbsp;JSSDK(&quot;替换成你的微信AppID&quot;,&nbsp;&quot;替换成你的微信AppSecret&quot;,$url);
$signPackage&nbsp;=&nbsp;$jssdk-&gt;GetSignPackage();
$tmp=json_encode(array&nbsp;(&#39;appId&#39;=&gt;$signPackage[&quot;appId&quot;],&#39;timestamp&#39;=&gt;$signPackage[&quot;timestamp&quot;],&#39;nonceStr&#39;=&gt;$signPackage[&quot;nonceStr&quot;],&#39;signature&#39;=&gt;$signPackage[&quot;signature&quot;],&#39;url&#39;=&gt;$signPackage[&quot;url&quot;]));
$callback&nbsp;=&nbsp;$_GET[&#39;callback&#39;];
echo&nbsp;$callback.&#39;(&#39;.$tmp.&#39;)&#39;;
exit;
?&gt;</pre><p>把文件里的这行改成你自己的：</p><p>$jssdk = new JSSDK(&quot;<span style="color: rgb(255, 0, 0);">替换成你的微信AppID</span>&quot;, &quot;<span style="color: rgb(255, 0, 0);">替换成你的微信AppSecret</span>&quot;,$url);</p><p><br/></p><p><span style="text-wrap: wrap;">步骤四：创建<span style="text-wrap: wrap;">.json</span>文件&nbsp;access_token.json 和 jsapi_ticket.json&nbsp; 跟 <strong>jssdk.php</strong> 文件一起放在<span style="text-wrap: wrap;">/wx/文件夹下面</span></span></p><p><span style="text-wrap: wrap;"><span style="text-wrap: wrap;"><br/></span></span></p><p><span style="text-wrap: wrap; color: rgb(255, 0, 0);">access_token.json文件内容</span></p><pre class="brush:php;toolbar:false">{&quot;expire_time&quot;:1689084921,&quot;access_token&quot;:&quot;70_mZT8x1dP0QWIvQs5Mny032nzE6gsaj4Fr1topbmiHy9Zi-3NtOL4Y73Twiuxk-Apun8-ej5YGhzcXcLyV_O8Y0c4MXaXXAJ-E9aAtIw1ebC6Sdox4XVgLf1qD2YQSLcAFAGIB&quot;}</pre><p><span style="color: rgb(255, 0, 0); text-wrap: wrap;"><br/></span></p><p><span style="text-wrap: wrap;"></span><span style="color: rgb(255, 0, 0); text-wrap: wrap;">&nbsp;jsapi_ticket.json<span style="text-wrap: wrap;">文件内容</span></span></p><pre class="brush:php;toolbar:false">{&quot;expire_time&quot;:1689084921,&quot;jsapi_ticket&quot;:&quot;O3SMpm8bG7kJnF36aXbe8yK-ToWfj2J-6mu1g5prKHQfN7qSwmU9pAmRC6bLAE5izB1mzf7-QWXFyGhwcPfGrw&quot;}</pre><p><span style="text-wrap: wrap;"><span style="text-wrap: wrap;"></span></span><br/></p><p><span style="text-wrap: wrap;">这两个文件用来缓存，防止超过调用频率！（<span style="text-wrap: wrap;">PS：</span>微信公众号<span style="text-wrap: wrap;">获取</span>access_token一天最多调用2000次，超过了可以申请归0一个月最多10次，获取jsapi_ticket一天最多调用100万次）</span></p><p><span style="text-wrap: wrap;"><br/></span></p><p>最后，别忘了存放这个PHP的文件夹权限为可写（如果放在网站根目录请忽略）。</p><p>（PS：微信对分享内容大小有限制，如果自定义图标文件过大，不然会导致描述不显示，图片最好控制在30Kb左右，图片比例5：4，<span style="color: rgb(255, 0, 0);">简介要用 clear_html() 去掉没用的字符只留文字不然分享会有问题！</span>）</p><p><br/></p><p>这样就可以了！</p><p><br/></p>]]></description><category>网络技术</category><comments>http://guopingblog.com/post/113.html#comment</comments><wfw:commentRss>http://guopingblog.com/feed.asp?cmt=113</wfw:commentRss></item></channel></rss>
