PHP
nsy1989
不创造代码,只是代码的搬用工(*^_^*)!
展开
-
Lavarel 将查询结果转换为数组
【代码】Lavarel 将查询结果转换为数组。原创 2023-10-07 09:29:33 · 230 阅读 · 0 评论 -
PHP冒泡排序用Golang转换
【代码】PHP冒泡排序用Golang转换。原创 2023-07-14 15:14:30 · 130 阅读 · 0 评论 -
JS使用encodeURIComponent 编码,PHP进行解码
<script>var uri="php_is a pro...";var str = encodeURIComponent(uri);document.write(str);//输出:php_is%20a%20pro... </script> <?php// js encodeURIComponent编码// php urldecode解码$url ="php_is%20a%20pro...";echo urldecode($url);//输.原创 2021-09-27 14:12:18 · 1025 阅读 · 0 评论 -
Laravel6 alioss上传csv 并读取远程csv文件
参考地址:https://github.com/littlePHP/AliyunOSS1.composer安装阿里云oss插件;composer require johnlui/aliyun-oss:~2.02.app/services/OSS.php<?phpnamespace App\Services;use JohnLui\AliyunOSS;use Exception;use DateTime;class OSS { /* 城市名称: *原创 2021-07-15 11:23:08 · 692 阅读 · 1 评论 -
PHP 反射
php版本:php7.3.4<?phpinterface Blog{ public function rt();}class FileBlog implements Blog{ public function rt(){ echo "file"; }}class DbBlog implements Blog{ public function rt(){ echo "DB"; } }class User { protected $opt; public原创 2021-07-01 10:54:24 · 108 阅读 · 0 评论 -
Centos7+phalcon3.0安装
环境:centos7+php5.6+mysql5.6(宝塔一键安装环境)注意:安装前先将php.ini配置文件中的禁用函数打开:比如:proc_open等/www/server/php/56/etc/php.ini(仅供参考)disable_functions = passthru,putenv,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_w原创 2021-02-01 16:23:53 · 272 阅读 · 0 评论 -
Phalcon7 nginx配置
server { listen 80 default_server reuseport; #listen [::]:80 default_server ipv6only=on; server_name _; root "/home/wwwroot/default/pc7/public"; index index.php index.html index.htm; charset utf-8; location / { try_files $.原创 2021-01-21 07:34:57 · 138 阅读 · 0 评论 -
Centos7 安装php7 memcache扩展
注意:php环境已经安装完成。没有php环境的话,需要先安装再进行此操作。1.安装memcache:yum install libevent libevent-develyum install memcached2.下载php扩展,并安装。wget https://github.com/websupport-sk/pecl-memcache/archive/NON_BLOCKING_IO_php7.zipunzip NON_BLOCKING_IO_php7.zipcd pec.原创 2020-08-23 08:27:05 · 480 阅读 · 0 评论 -
php class类名::class
PHP自5.5版本起,新增类静态属性class;该属性返回当前类完整的类名,包括名命名空间。示例:print_r(ComposerStaticInitd44fc61b89e2fba85b9a83682a281ca8::class);//Composer\Autoload\ComposerStaticInitd44fc61b89e2fba85b9a83682a281ca8...原创 2019-11-29 15:46:01 · 395 阅读 · 0 评论 -
Tp5.1在控制器(controller)或模型层(model)获取路径相关环境变量
<?phpnamespace app\index\controller;class TestController extends Controller{ public function test() { print_r(\Env::get('think_path')); print_r(\Env::get('root_path'));...原创 2019-11-28 14:49:41 · 1253 阅读 · 0 评论 -
windows下创建symfony 项目
备注:php版本5.4以上;1.打开dos,将目录切换至web服务器根目录(比如:c:/www);2.下载symfony脚本文件(备注需将php加入环境变量);php -r "readfile('http://symfony.com/installer');" > symfony3.执行symfony脚本进行初始化;php symfony4.各项准备操...原创 2019-11-01 13:51:50 · 215 阅读 · 0 评论 -
windows 下安装php ionCube 扩展
1.下载loader-wizard.php文件,将该文件放在web服务器根目录;loader-wizard.php下载地址:https://download.csdn.net/download/dreamleadtoword/119494072.运行loader-wizard.php,并按【Installation Instructions】提示步骤进行安装;下载zip压缩文件;...原创 2019-11-01 13:05:12 · 1030 阅读 · 0 评论 -
PHP 使用exec函数
PHP exec函数使用:1.检测exec函数是否开启:<?php//被禁用的函数集$disable_functions = ini_get('disable_functions');//转换为数组$disabled = explode(',', $disable_functions);//判断是否包含在被禁用的数组中if(in_array('exec', $di...原创 2019-10-23 15:47:31 · 462 阅读 · 0 评论 -
php将远程图片/文件下载到本地
php下载远程图片或者文件到本地的方法较多,copy(copy函数:拷贝资源)算一种。示例如下:$img_url = 'http://www.xxx.xx/a4ed1d.jpg.500x500.jpg';if(copy(trim($img_url), 'img/' . basename($img_url))){ echo "远程图片下载成功";}备注:1.img文件夹要先...原创 2018-11-10 11:36:28 · 1694 阅读 · 0 评论 -
PHP 字符串组合示例
//字符串组合函数function StrCombinations($arr, $len=0,&$res, $str=""){ $arr_len = count($arr); if($len == 0){ $res[] = $str; }else{ for($i=0; $i<$arr_len; $i++){ ...原创 2018-11-01 07:40:51 · 1073 阅读 · 0 评论