<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>PHP on 闻心阁</title>
    <link>https://yqc.im/tags/php/</link>
    <description>Recent content in PHP on 闻心阁</description>
    <generator>Hugo -- gohugo.io</generator>
    <lastBuildDate>Tue, 02 Jan 2024 14:35:11 +0800</lastBuildDate><atom:link href="https://yqc.im/tags/php/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>M1、M2 芯片 MacOS 下PHP开发环境搭建</title>
      <link>https://yqc.im/m1-m2-macos-php-development-environment-installation/</link>
      <pubDate>Tue, 02 Jan 2024 14:35:11 +0800</pubDate>
      
      <guid>https://yqc.im/m1-m2-macos-php-development-environment-installation/</guid>
      <description>&lt;p&gt;之前的网站是运行在PHP+MySQL环境上的，从Windows换成Mac之后，这个环境在本地搭建就比较麻烦，本文记录一下。&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Typecho网站竟然被放入了木马</title>
      <link>https://yqc.im/typecho-website-trojan/</link>
      <pubDate>Wed, 17 Feb 2021 23:25:36 +0800</pubDate>
      
      <guid>https://yqc.im/typecho-website-trojan/</guid>
      <description>&lt;p&gt;前几天把网站从基于PHP的Typecho迁移到了基于Go语言的Hugo，从一个动态网站变成了一个静态化的网站了。我这人比较恋旧，于是把之前的数据备份一下，放在自己的网盘里，万一我有一天想不开又想用Typecho了呢？（应该没有这种万一）。于是打开了篱落主机的虚拟主机后台，使用DA面板作了一个备份，今晚老婆睡了，想把数据做个转移，于是Download下来，本来是解压一下看看下载文件是不是完整的，结果一解压，神奇的事情发生了。&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Laravel Cannot use PhpParser Node Scalar String as class name解决方案</title>
      <link>https://yqc.im/laravel-phpparser-node-scalar-string-error/</link>
      <pubDate>Sun, 14 Jan 2018 02:14:42 +0000</pubDate>
      
      <guid>https://yqc.im/laravel-phpparser-node-scalar-string-error/</guid>
      <description>在使用 Lavarel 生成项目的时候又出现了问题，报错如下:
Cannot use PhpParser Node Scalar String as class name 在网上搜索了一堆，后来发现还是PHP的版本引起来的问题。
问题原因 PHP 7 中将 String 作为了一个保留关键字。这与 PhpParser 这个库冲突了。
解决方案 方法一：升级 PhpParser 的版本
方法二：升级 Lavarel 版本</description>
    </item>
    
    <item>
      <title>安装 Laravel 报错 PHP extension mcrypt is missing 解决方案</title>
      <link>https://yqc.im/laravel-mcrypt-is-missing/</link>
      <pubDate>Sun, 14 Jan 2018 02:07:05 +0000</pubDate>
      
      <guid>https://yqc.im/laravel-mcrypt-is-missing/</guid>
      <description>在安装 Laravel 的时候按照网上的教程，出现了如下的错误
the requested PHP extension mcrypt is missing from your system 本来这种小错不值得记录，直接找到 php.ini 将 mcrypt 扩展打开即可。但是，我打开之后却没发现这个扩展。于是就去找这个扩展想下载安装，后来发现原来问题不在这里。
why 这是因为PHP的版本问题，在 PHP 7.1 中弃用了这个扩展，在 PHP 7.2 版本中完全移除了这个扩展。
但是我安装的时候因为要参考示例，于是安装了5.0版本的 Laravel，而5.0版本还是信赖这个扩展的。
解决方案 当然是安装最新的 Laravel。
把命令
composer create-project laravel/laravel laravel5 &amp;quot;~5.0.0&amp;quot; --prefer-dist 换成
composer create-project laravel/laravel laravel5 --prefer-dist </description>
    </item>
    
    <item>
      <title>Windows下使用XAMPP安装Laravel</title>
      <link>https://yqc.im/windows-xampp-laravel-install/</link>
      <pubDate>Sat, 13 Jan 2018 20:30:00 +0000</pubDate>
      
      <guid>https://yqc.im/windows-xampp-laravel-install/</guid>
      <description>自学当下最流行的PHP框架 Laravel，官网推荐使用 Homestead ，查了一下使用 Windows 安装这玩意有点折腾，并且我这老爷机能自己运行起来就不错了，还什么虚拟机。于是使用 XAMPP 来安装，做个简单的记录。
安装XAMPP 直接去官网下载最新版本，PHP版本为7.2.0，好久没写PHP了，也应该接触下新版本。
安装Composer 安装 Laravel 最好使用 Composer, 这是PHP的包管理器，类似 NodeJS 的 NPM。直接去官网下载 Windows 版本。下载之后直接各种 Next 就行， 不过有一个地方要注意。
这里要设置一下 php.exe 路径。
设置Composer源 毫无疑问，Composer 和 NPM 一样，国内使用是没那么方便的，所以要设置一一个国内的源。下面2个可以任选一个。
Packagist 镜像
Composer 中国镜像
设置方法按照官网来即可。
安装 Laravel 使用 cmd 进入 xampp/htdoc 目录，运行下面的命令
composer create-project laravel/laravel learnlaravel5 这样就生成了一个 Laravel 的项目了，浏览器打开下面的网址
http://localhost/laravel/public/index.php
看到下面的界面表示安装成功。
参考 国内使用composer的正确姿势
在 xampp 环境下安装 laravel</description>
    </item>
    
    <item>
      <title>PHP Cross-domain Setting</title>
      <link>https://yqc.im/php-cross-domain-setting/</link>
      <pubDate>Sun, 07 Aug 2016 16:07:08 +0000</pubDate>
      
      <guid>https://yqc.im/php-cross-domain-setting/</guid>
      <description>&lt;p&gt;In the previous article 《&lt;a href=&#34;http://lab.yqc.im/jquery-ajax-method-igonre-undefined-values.html&#34;&gt;jQuery $.ajax Method Ignored the Undefined Values&lt;/a&gt;》, I send a request to the server&amp;rsquo;s php file, maybe you would get a cross-domain error.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;XMLHttpRequest cannot load http://127.0.0.1/jq-undefined.php?para1=1&amp;amp;para2=2. No &#39;Access-Control-Allow-Origin&#39; header is present on the requested resource. Origin &#39;null&#39; is therefore not allowed access.
&lt;/code&gt;&lt;/pre&gt;</description>
    </item>
    
    <item>
      <title>PHP调用内部函数</title>
      <link>https://yqc.im/php-inner-function/</link>
      <pubDate>Sun, 05 Apr 2015 13:51:00 +0000</pubDate>
      
      <guid>https://yqc.im/php-inner-function/</guid>
      <description>PHP调用内部的函数需要加“self”，示例：
self::函数名(参数) </description>
    </item>
    
    <item>
      <title>PHP中json_encode无法处理中文</title>
      <link>https://yqc.im/php-json-encode-is-unable-to-process-chinese/</link>
      <pubDate>Sun, 18 Nov 2012 18:01:26 +0000</pubDate>
      
      <guid>https://yqc.im/php-json-encode-is-unable-to-process-chinese/</guid>
      <description>使用ajax调用某一个php文件，在php文件中json_encode一下，返回的中文竟然为null，而英文显示正常，后来发现这是一个小问题，解决方法如下：</description>
    </item>
    
    <item>
      <title>PHP Function ereg() is deprecated Error 解决方案</title>
      <link>https://yqc.im/php-function-ereg-is-deprecated-error-solution/</link>
      <pubDate>Mon, 05 Nov 2012 18:37:28 +0000</pubDate>
      
      <guid>https://yqc.im/php-function-ereg-is-deprecated-error-solution/</guid>
      <description> 在linux下折腾php开发，安装了最新的xampp 1.8,结果出现了如下问题： Function ereg() is deprecated Error. 问题原因： 在PHP5.3.0以后取消了对ereg函数的支持，所以会出现如下提示。 解决方案： 1.使用php 5.2版本（如果需要改动的很多，并且又不特别需要新版本的话，可以使用此方法） 2.修改程序源代码，把ereg替换成preg_match，ereg_replace替换成preg_replace. 其他问题： 注意：替换函数后，使用方法并不完全一致，请参照官方网站。 </description>
    </item>
    
    <item>
      <title>Wordpress错误 Cannot modify header information</title>
      <link>https://yqc.im/wordpress-error-cannot-modify-header-information/</link>
      <pubDate>Mon, 29 Oct 2012 12:54:50 +0000</pubDate>
      
      <guid>https://yqc.im/wordpress-error-cannot-modify-header-information/</guid>
      <description>&lt;p&gt;今天登录网站后台，突然发现后台登录不进去了，提示错误 Cannot modify header information
细细想来自己也没做什么，应该是虚拟主机改了php的什么设置。&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>PHP header函数</title>
      <link>https://yqc.im/php-header-function/</link>
      <pubDate>Tue, 23 Oct 2012 14:32:16 +0000</pubDate>
      
      <guid>https://yqc.im/php-header-function/</guid>
      <description>&lt;p&gt;
header()函数用来发送原始的HTTP报头。
常见的报头如下:
&lt;/p&gt;
&lt;blockquote&gt;
Content-Type: xxxx/yyyy
Location: xxxx:yyyy/zzzz
Status: nnn xxxxxx
&lt;/blockquote&gt;</description>
    </item>
    
    <item>
      <title>PHP Session过期时间设定</title>
      <link>https://yqc.im/php-session-expiration-time-set/</link>
      <pubDate>Mon, 22 Oct 2012 18:45:41 +0000</pubDate>
      
      <guid>https://yqc.im/php-session-expiration-time-set/</guid>
      <description>&lt;p&gt;继续PHP中的Session话题，在PHP中主要通过设置session.gc_maxlifetime来设定Session的生存周期。例如：&lt;/p&gt;
&lt;pre&gt;&amp;lt;?php
ini_set(&#39;session.gc_maxlifetime&#39;, 3600); //设置时间
ini_get(&#39;session.gc_maxlifetime&#39;);//得到ini中设定值
?&gt;
&lt;/pre&gt;</description>
    </item>
    
    <item>
      <title>PHP Session总结</title>
      <link>https://yqc.im/php-session-summary/</link>
      <pubDate>Mon, 22 Oct 2012 17:21:40 +0000</pubDate>
      
      <guid>https://yqc.im/php-session-summary/</guid>
      <description>&lt;p&gt;Session可以理解为php存储在服务器断的cookie，但是对于cookie来说因为是存储在用户电脑上，所以并不能保证安全性。但是session不同，因为是存储在服务器端，用户并没有权限对Session进行读写，所以使用过程要比cookie安全&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>PHP define 函数</title>
      <link>https://yqc.im/php-define-function/</link>
      <pubDate>Mon, 22 Oct 2012 11:02:32 +0000</pubDate>
      
      <guid>https://yqc.im/php-define-function/</guid>
      <description>&lt;p&gt;无意中接触了PHP的define函数，本来一个定义的函数没怎么在意。今天发现了这个函数的一个好玩的功能：大小写&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>关于dirname(__FILE__)记录 </title>
      <link>https://yqc.im/dirname-file/</link>
      <pubDate>Sun, 21 Oct 2012 21:16:37 +0000</pubDate>
      
      <guid>https://yqc.im/dirname-file/</guid>
      <description>__FILE__ :被称为PHP魔术常量 ,返回当前执行PHP脚本的完整路径和文件名,包含一个绝对路径
dirname(__FILE__) 函数返回的是脚本所在在的路径。
dirname(dirname(__FILE__));得到的是文件上一层目录名</description>
    </item>
    
    <item>
      <title>PHP遍历文件的4种方法</title>
      <link>https://yqc.im/php-files-traversal/</link>
      <pubDate>Thu, 30 Aug 2012 02:48:00 +0000</pubDate>
      
      <guid>https://yqc.im/php-files-traversal/</guid>
      <description>&lt;p&gt;一次实习中用到了PHP遍历文件夹中的文件，无奈对于php是一窍不通，所以转载下面的文章。&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>php写入mysql中文乱码</title>
      <link>https://yqc.im/php-mysql-utf8/</link>
      <pubDate>Fri, 09 Mar 2012 21:25:00 +0000</pubDate>
      
      <guid>https://yqc.im/php-mysql-utf8/</guid>
      <description>&lt;p&gt;php中关于mysql的操作非常简单，然而最近在做一个小工具的时候发现php写入mysql的数据库中出现了中文字符的乱码，这个乱码的问题纠结了我好久，明明英文字符写入正常，但是中文就是乱码！&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>wordpress文章中插入php代码</title>
      <link>https://yqc.im/php-wordpress-code/</link>
      <pubDate>Fri, 02 Mar 2012 18:33:00 +0000</pubDate>
      
      <guid>https://yqc.im/php-wordpress-code/</guid>
      <description>&lt;p&gt;
这几天在一边写主题一边总结学到的一些经验，如题所示，在wordpress文章中插入php代码竟然出错了，这真是让人有点纠结。因为之前一直学的是C++，插入代码也没有什么问题，然而插入php去只显示了一部分代码！
&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>XAMPP中php上传中文文件乱码</title>
      <link>https://yqc.im/php-chinese-messy-code/</link>
      <pubDate>Fri, 24 Feb 2012 13:21:00 +0000</pubDate>
      
      <guid>https://yqc.im/php-chinese-messy-code/</guid>
      <description>&lt;p&gt;这几天在windows下安装了XAMPP，准备初步学习一下php的相关内容。这几天接触到了php上传文件，但是出现了一个郁闷问题，我准备上传一个excel文件，但是如果文件名是中文名就会报错。&lt;/p&gt;</description>
    </item>
    
  </channel>
</rss>
