阿里云虚拟主机设置301重定向

阿里云虚拟主机设置301重定向 阿里云虚拟主机后台可以设置301重定向,但是这个重定向仅限根目录 子目录重定向的话需要修改.htaccess文件 到这个网站生成一个.htaccess文件后上传的虚拟主机的web根目录(/htdocs)即可 <Files ~ "^.(htaccess|htpasswd)$"> deny from all </Files> RewriteEngine on RewriteCond %{HTTP_HOST} ^(bovod\.org)(:80)? [NC] RewriteRule ^(.*) https://www.bovod.org/$1 [R=301,L] order deny,allow

2019-12-28

php7的isset方法改动

给typecho添加自定义变量时参考typecho官网文档自定义字段使用,添加如下代码,结果代码始终跑到else里。 if(isset($this->fields->fieldName)){ echo '字段存在,值为:'.$this->fields->fieldName; }else{ echo '字段不存在'; } 原来php5.6版本判断是先执行$this->fields->fieldName然后再对结果进行判断,而php7则将$this->fields->fieldName整体作为一个变量进行判断。 改后的代码 $field = $this->fields->fieldName if(isset($field)){ echo '字段存在,值为:'.$field; }else{ echo '字段不存在'; } 参考升级 PHP7 后 isset 不太对了

2019-12-05

centos7安装php72

安装epel-release源 yum -y install epel-release 安装webtatic-release源 rpm -ivh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm 安装php72 yum -y install mod_php72w php72w-cli php72w-fpm php72w-common php72w-devel php72w-gd

2019-11-26

php验证码报错

使用php生成验证码时报错! Call to undefined function Intervention\Image\Gd\imagettfbbox() 先看下是否安装gd brew info gd gd: stable 2.2.5 (bottled), HEAD Graphics library to dynamically manipulate images https://libgd.github.io/ Not installed From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/gd.rb ==> Dependencies Required: fontconfig ✔, freetype ✔, jpeg ✔, libpng ✔, libtiff ✔, webp ✔ ==> Options --HEAD Install HEAD version 发现没有,安装gd brew install gd 重启php后发现还是不行,卸载php重新安装 brew install [email protected] --with-httpd --with-freetype 报错,发现brew不支持自定义编译参数了 然后卸载[email protected]安装[email protected] 还是不行,, php -version 发现版本还是7.1,这时候豁然开朗,我原来一直用的是mac自带的php mv /usr/bin/php php.bak echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/....

2019-11-26

macos 安装 composer

https://getcomposer.org/download/ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php -r "if (hash_file('sha384', 'composer-setup.php') === 'a5c698ffe4b8e849a443b120cd5ba38043260d5c4023dbf93e1558871f1f07f58274fc6f4c93bcfd858c6bd0775cd8d1') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" php composer-setup.php php -r "unlink('composer-setup.php');" 执行完以上命令会将composer安装到当前目录,然后再将composer拷贝到bin目录 mv composer.phar /usr/local/bin/composer

2019-11-25