<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>圣泉山人</title>
    <description>my blogs</description>
    <link>https://myyphp.github.io/</link>
    <atom:link href="https://myyphp.github.io/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Thu, 10 Jan 2019 03:44:26 +0000</pubDate>
    <lastBuildDate>Thu, 10 Jan 2019 03:44:26 +0000</lastBuildDate>
    <generator>Jekyll v3.7.4</generator>
    
      <item>
        <title>PHP单元测试（四） 日志记录</title>
        <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#概述&quot; id=&quot;markdown-toc-概述&quot;&gt;概述&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;概述&quot;&gt;概述&lt;/h1&gt;

对于测试的结果，可以直接在 标准输出 中看到，但是对于测试内容比较多时，标准输出 就不那么友好和直观了。

这时，我们可以借助日志文件的方式，来更加直观的分析结果。

</description>
        <pubDate>Wed, 04 Jul 2018 10:14:54 +0000</pubDate>
        <link>https://myyphp.github.io/2018/07/04/PHP%E5%8D%95%E5%85%83%E6%B5%8B%E8%AF%95-%E5%9B%9B-%E6%97%A5%E5%BF%97%E8%AE%B0%E5%BD%95/</link>
        <guid isPermaLink="true">https://myyphp.github.io/2018/07/04/PHP%E5%8D%95%E5%85%83%E6%B5%8B%E8%AF%95-%E5%9B%9B-%E6%97%A5%E5%BF%97%E8%AE%B0%E5%BD%95/</guid>
        
        <category>PHP</category>
        
        <category>单元测试</category>
        
        <category>PHPUnit</category>
        
        
        <category>Notes</category>
        
      </item>
    
      <item>
        <title>PHP单元测试（三） 测试替身</title>
        <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#测试替身&quot; id=&quot;markdown-toc-测试替身&quot;&gt;测试替身&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;测试替身&quot;&gt;测试替身&lt;/h1&gt;

在测试的时候，我们会经常遇到引用了外部依赖的对象，比如：发送邮件、Log记录、文件系统操作等等，这些外部依赖我们很难控制，这时，就可以通过测试替身来模拟这些外部依赖行为，从而让测试进行下去。

PHPUnit 提供了生成测试替身对象的方法：
&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;createMock($type)&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;getMockBuilder($type)&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

前者返回的对象 = 后者使用默认值生成的对象

</description>
        <pubDate>Tue, 03 Jul 2018 10:14:54 +0000</pubDate>
        <link>https://myyphp.github.io/2018/07/03/PHP%E5%8D%95%E5%85%83%E6%B5%8B%E8%AF%95-%E4%B8%89-%E6%B5%8B%E8%AF%95%E6%9B%BF%E8%BA%AB/</link>
        <guid isPermaLink="true">https://myyphp.github.io/2018/07/03/PHP%E5%8D%95%E5%85%83%E6%B5%8B%E8%AF%95-%E4%B8%89-%E6%B5%8B%E8%AF%95%E6%9B%BF%E8%BA%AB/</guid>
        
        <category>PHP</category>
        
        <category>单元测试</category>
        
        <category>PHPUnit</category>
        
        
        <category>Notes</category>
        
      </item>
    
      <item>
        <title>PHP单元测试（二） 数据库测试</title>
        <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#数据库测试&quot; id=&quot;markdown-toc-数据库测试&quot;&gt;数据库测试&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;数据库测试&quot;&gt;数据库测试&lt;/h1&gt;

数据库测试的四个阶段：

&lt;ul&gt;
  &lt;li&gt;建立基境&lt;/li&gt;
  &lt;li&gt;执行被测系统&lt;/li&gt;
  &lt;li&gt;验证结果&lt;/li&gt;
  &lt;li&gt;拆除基境&lt;/li&gt;
&lt;/ul&gt;

</description>
        <pubDate>Mon, 02 Jul 2018 10:14:54 +0000</pubDate>
        <link>https://myyphp.github.io/2018/07/02/PHP%E5%8D%95%E5%85%83%E6%B5%8B%E8%AF%95-%E4%BA%8C-%E6%95%B0%E6%8D%AE%E5%BA%93%E6%B5%8B%E8%AF%95/</link>
        <guid isPermaLink="true">https://myyphp.github.io/2018/07/02/PHP%E5%8D%95%E5%85%83%E6%B5%8B%E8%AF%95-%E4%BA%8C-%E6%95%B0%E6%8D%AE%E5%BA%93%E6%B5%8B%E8%AF%95/</guid>
        
        <category>PHP</category>
        
        <category>单元测试</category>
        
        <category>PHPUnit</category>
        
        
        <category>Notes</category>
        
      </item>
    
      <item>
        <title>API接口签名算法</title>
        <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#api-安全隐患&quot; id=&quot;markdown-toc-api-安全隐患&quot;&gt;API 安全隐患&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;api-安全隐患&quot;&gt;API 安全隐患&lt;/h1&gt;

目前我们公司接口全部采取的是 HTTP 协议，接口的权限是通过验证 TOKEN 令牌（用户登录成功后，通过用户id参与生成的唯一码）。

存在的隐患：可以通过抓包很容易获取到 TOKEN，此后便可以对系统做很多攻击操作了，比如：恶意数据插入、修改参数等等。

因此，需要对API的请求加上更多安全验证。

这里，计划采用数据签名的方式来防止参数修改。至于其他像恶意数据插入这些安全隐患可以从业务逻辑上防止，就不在这里处理了。

</description>
        <pubDate>Wed, 02 May 2018 10:14:54 +0000</pubDate>
        <link>https://myyphp.github.io/2018/05/02/API%E6%8E%A5%E5%8F%A3%E7%AD%BE%E5%90%8D%E7%AE%97%E6%B3%95/</link>
        <guid isPermaLink="true">https://myyphp.github.io/2018/05/02/API%E6%8E%A5%E5%8F%A3%E7%AD%BE%E5%90%8D%E7%AE%97%E6%B3%95/</guid>
        
        <category>算法</category>
        
        
        <category>PHP</category>
        
      </item>
    
      <item>
        <title>AES算法</title>
        <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#概述&quot; id=&quot;markdown-toc-概述&quot;&gt;概述&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;概述&quot;&gt;概述&lt;/h1&gt;

AES （Advanced Encryption Standard）, 是一种很常见的对称加密算法，通信双方保存一致的私钥，来完成加密解密。 Web开发中，通常被用于加密传输密码等重要信息。

通信原理：

&lt;img src=&quot;/static/img/aes1.png&quot; alt=&quot;image&quot; /&gt;

</description>
        <pubDate>Wed, 02 May 2018 10:14:54 +0000</pubDate>
        <link>https://myyphp.github.io/2018/05/02/AES%E7%AE%97%E6%B3%95/</link>
        <guid isPermaLink="true">https://myyphp.github.io/2018/05/02/AES%E7%AE%97%E6%B3%95/</guid>
        
        <category>算法</category>
        
        
        <category>PHP</category>
        
      </item>
    
      <item>
        <title>PHP单元测试（一） 基础</title>
        <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#概述&quot; id=&quot;markdown-toc-概述&quot;&gt;概述&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;概述&quot;&gt;概述&lt;/h1&gt;

&lt;blockquote&gt;
  单元测试（unit testing），是指对软件中的最小可测试单元进行检查和验证。 –百度百科
&lt;/blockquote&gt;

</description>
        <pubDate>Wed, 02 May 2018 10:14:54 +0000</pubDate>
        <link>https://myyphp.github.io/2018/05/02/PHP%E5%8D%95%E5%85%83%E6%B5%8B%E8%AF%95-%E4%B8%80-%E5%9F%BA%E7%A1%80/</link>
        <guid isPermaLink="true">https://myyphp.github.io/2018/05/02/PHP%E5%8D%95%E5%85%83%E6%B5%8B%E8%AF%95-%E4%B8%80-%E5%9F%BA%E7%A1%80/</guid>
        
        <category>PHP</category>
        
        <category>单元测试</category>
        
        <category>PHPUnit</category>
        
        
        <category>Notes</category>
        
      </item>
    
      <item>
        <title>阿里RDS数据库连接异常 table_definition_cache</title>
        <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#异常现象&quot; id=&quot;markdown-toc-异常现象&quot;&gt;异常现象&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;异常现象&quot;&gt;异常现象&lt;/h1&gt;

公司使用了阿里云的 RDS 数据库，里面存放了多个项目的数据库。

今天在发布一个新的项目后，同时将对应的数据库放进去了，可是代码在运行时，出现了如下错误：

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;ERROR&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1615&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;HY000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Prepared&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;statement&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;needs&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;be&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;re&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;prepared&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</description>
        <pubDate>Thu, 15 Mar 2018 10:14:54 +0000</pubDate>
        <link>https://myyphp.github.io/2018/03/15/%E9%98%BF%E9%87%8CRDS%E6%95%B0%E6%8D%AE%E5%BA%93%E8%BF%9E%E6%8E%A5%E5%BC%82%E5%B8%B8-table_definition_cache/</link>
        <guid isPermaLink="true">https://myyphp.github.io/2018/03/15/%E9%98%BF%E9%87%8CRDS%E6%95%B0%E6%8D%AE%E5%BA%93%E8%BF%9E%E6%8E%A5%E5%BC%82%E5%B8%B8-table_definition_cache/</guid>
        
        <category>MYSQL</category>
        
        <category>阿里云</category>
        
        <category>异常</category>
        
        
        <category>MySQL</category>
        
      </item>
    
      <item>
        <title>PHP压缩文件时的乱码问题</title>
        <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#问题描述&quot; id=&quot;markdown-toc-问题描述&quot;&gt;问题描述&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;问题描述&quot;&gt;问题描述&lt;/h1&gt;

项目中有个这样的需求：为客户生成报表时，是根据每种类型生成了一个报表，最后通过 &lt;code class=&quot;highlighter-rouge&quot;&gt;PHPZip&lt;/code&gt; 类实现打包。

但是，发现如果将待打包的文件使用中文命名时，就会出现乱码（在linux上使用时）。

</description>
        <pubDate>Fri, 01 Dec 2017 12:14:54 +0000</pubDate>
        <link>https://myyphp.github.io/2017/12/01/PHP%E5%8E%8B%E7%BC%A9%E6%96%87%E4%BB%B6%E6%97%B6%E7%9A%84%E4%B9%B1%E7%A0%81%E9%97%AE%E9%A2%98/</link>
        <guid isPermaLink="true">https://myyphp.github.io/2017/12/01/PHP%E5%8E%8B%E7%BC%A9%E6%96%87%E4%BB%B6%E6%97%B6%E7%9A%84%E4%B9%B1%E7%A0%81%E9%97%AE%E9%A2%98/</guid>
        
        <category>PHP</category>
        
        
        <category>PHP</category>
        
      </item>
    
      <item>
        <title>PHP反射</title>
        <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#什么是反射&quot; id=&quot;markdown-toc-什么是反射&quot;&gt;什么是反射&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;什么是反射&quot;&gt;什么是反射&lt;/h1&gt;

反射是指在PHP运行状态中，扩展分析PHP程序，导出或提出关于类、方法、属性、参数等的详细信息，包括注释。这种动态获取信息以及动态调用对象方法的功能称为反射。

</description>
        <pubDate>Wed, 05 Apr 2017 12:14:54 +0000</pubDate>
        <link>https://myyphp.github.io/2017/04/05/PHP%E5%8F%8D%E5%B0%84/</link>
        <guid isPermaLink="true">https://myyphp.github.io/2017/04/05/PHP%E5%8F%8D%E5%B0%84/</guid>
        
        <category>反射</category>
        
        <category>PHP</category>
        
        
        <category>PHP</category>
        
      </item>
    
      <item>
        <title>PHP SAPI</title>
        <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#什么是-php-sapi&quot; id=&quot;markdown-toc-什么是-php-sapi&quot;&gt;什么是 PHP SAPI？&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;什么是-php-sapi&quot;&gt;什么是 PHP SAPI？&lt;/h2&gt;

PHP脚本要执行有很多种方式，比如：通过Web服务器、直接在命令行下、嵌入在其他程序中。
&lt;code class=&quot;highlighter-rouge&quot;&gt;SAPI&lt;/code&gt;（&lt;code class=&quot;highlighter-rouge&quot;&gt;Server Application Programming Interface&lt;/code&gt;）提供了一个和外部通信的接口，常见的&lt;code class=&quot;highlighter-rouge&quot;&gt;SAPI&lt;/code&gt;有：
&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;cgi&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;fast-cgi&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;cli&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;isapi&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;apache&lt;/code&gt; 模块的 &lt;code class=&quot;highlighter-rouge&quot;&gt;DLL&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;strong&gt;因此，&lt;code class=&quot;highlighter-rouge&quot;&gt;PHP SAPI&lt;/code&gt;即是：php与其他应用通信的接口。&lt;/strong&gt;

</description>
        <pubDate>Thu, 18 Aug 2016 12:14:54 +0000</pubDate>
        <link>https://myyphp.github.io/2016/08/18/PHP-SAPI/</link>
        <guid isPermaLink="true">https://myyphp.github.io/2016/08/18/PHP-SAPI/</guid>
        
        <category>PHP</category>
        
        <category>SAPI</category>
        
        
        <category>PHP</category>
        
      </item>
    
  </channel>
</rss>
