php
chengyuyuan_zh
这个作者很懒,什么都没留下…
展开
-
Thinkphp5.1上传图片并生成受缩略图
//上传图片$img = request()->file('file');// 移动到框架应用根目录/public/uploads/ 目录下$info = $img->move( '../dragon/public/uploads/goodsimg');//move(ROOT_PATH . 'public' . DS . 'uploads/goodsimg');if($info){ // 成功上传后 获取上传信息 $url = str_replace("\\","/",.原创 2020-09-01 10:41:14 · 538 阅读 · 0 评论 -
layui的表单提交,使用form.on('submit(sub)',function (){}) 使用ajax请求时回调不执行的原因及解决方法
一个让我永远难以忘怀的bug,使用ajax请求向后台请求一个执行结果,根据结果进行处理,出现回调无法执行,在submit后面加上一个return false就解决了form.on('submit(demo1)', function(data){ $.ajax({ type: 'post', url: "{:url('Putout/putout_add'...原创 2019-12-27 09:45:01 · 4209 阅读 · 1 评论 -
php7中??和?:的区别
$a=$c??$b;等同于 $a=isset($c)?$c:$b;$a=$c?:$b;等同于 $a=$c?$c:$b;原创 2018-05-14 11:19:11 · 23575 阅读 · 0 评论 -
PHP中单引号与双引号的区别
例子如下:$str='hello';echo "str is $str"; //运行结果: str is helloecho 'str is $str'; //运行结果: str is $str原创 2018-05-14 13:39:01 · 108 阅读 · 0 评论 -
linux系统下配置php环境
1.安装php:yum install -y httpd httpd-devel2.开起apache :service httpd start3.设置apache服务随系统自动启动:checonfig httpd --level 235 on4.测试apache,用浏览器访问服务器ip地址5.测试html文件能否正常访问进入(apache根目录) cd /var/www/html...原创 2018-07-08 10:07:55 · 874 阅读 · 0 评论 -
php操作mysql
1.建立连接:得到一个mysql连接资源 mysql_connect2.选择要操作的的数据库 mysql_select_db3.设置连接编码:mysql_query("set names 编码格式")4.执行sql语句得到的结果 mysql_query5.判断刚才的操作对数据库造成的影响的行数 mysql_affected_rows();6.解析查询结果 mysql_fet...原创 2018-07-08 10:18:15 · 118 阅读 · 0 评论 -
php结合redis秒杀
public function _initialize(){ parent::_initialize(); $goods_id = I("goods_id",'0','intval'); if($goods_id){ $this->goods_id = $goods_id; $this...转载 2018-09-17 14:07:31 · 164 阅读 · 0 评论 -
thinkphp中__construct与_initialize()的区别
创建的FatherAction.class.php文件<?phpclass FatherAction extends Action{ public function __construct(){ echo 'father'; }}?>创建的SonAction.class.php文件<?phpclass SonAction extend...转载 2018-11-21 14:04:36 · 112 阅读 · 0 评论 -
PHP 使用 CURL 发送HTTP请求
functionhttp($url,$method,$postfields=NULL,$headers=array()){ $this->http_info=array(); $ci=curl_init(); /*Curlsettings*/ curl_setopt...转载 2018-12-10 10:22:48 · 609 阅读 · 0 评论 -
$this和self的区别
一句话,self是引用静态类的类名,而$this是引用非静态类的实例名。原创 2018-12-11 12:00:27 · 500 阅读 · 0 评论 -
yii2的CURD操作
一.新增使用model::save()操作进行新增数据$user= new User;$user->username =$username;$user->password =$password;$user->save()使用createCommand()进行新增数据Yii::$app->db->createCommand()->ins...原创 2018-12-17 14:43:09 · 820 阅读 · 0 评论 -
php给图片添加水印
$dst_path = 'myimage.jpg';$src_path = 'http://www.logodashi.com/FileUpLoad/inspiration/636003768803214440.jpg';//创建图片的实例$dst = imagecreatefromstring(file_get_contents($dst_path));$src = imagecreat...转载 2018-05-14 09:19:04 · 182 阅读 · 0 评论