千里不留行 发布的文章

var str=' 测试 ';
一、函数

function trim(str){ //删除左右两端的空格
 return str.replace(/(^\s*)|(\s*$)/g, "");
}
function ltrim(str){ //删除左边的空格
 return str.replace(/(^\s*)/g,"");
}
function rtrim(str){ //删除右边的空格
 return str.replace(/(\s*$)/g,"");
}

函数调用 trim(str)

二、js对象的方法

String.prototype.trim=function(){
    return this.replace(/(^\s*)|(\s*$)/g, "");
}
String.prototype.ltrim=function(){
    return this.replace(/(^\s*)/g,"");
}
String.prototype.rtrim=function(){
    return this.replace(/(\s*$)/g,"");
}

类中方法调用 str.trim();

原因是网站目录指向的是public
解决办法:
1.cd 到nginx目录下,打开fastcgi.conf
2.vim /usr/local/nginx/conf/fastcgi.conf
3.修改 (yy + p复制行)

fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/";  

改为

 fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/../:/tmp/:/proc/";

重启ngnix或者lnmp即可
php_basedir.png

第一步:在lnmp1.4找到php安装的版本
lnmp1.4/src
使用命令 tar -jxvf php-7.1.7.tar.bz2 解压

第二步: 在解压的php-7.1.7文件夹里找到fileinfo文件夹,然后使用命令 cd /home/xxx/lnmp1.4/src/php-7.1.7/ext/fileinfo 进入到fileinfo文件夹
在此目录下执行
第三步:/usr/local/php/bin/phpize,得到数据
在此目录下执行
第四步: 使用如下命令编译安装

./configure -with-php-config=/usr/local/php/bin/php-config
make && make install

第五步:再修改/usr/local/php/etc/php.ini 查找:extension = 再最后一个extension= 后面添加上extension = "fileinfo.so" 保存,执行/etc/init.d/php-fpm restart 重启。