随笔分类 -  PHP

摘要:微擎form表单进行GET提交时,要传递 name 分别为 c , a , m , do 的值 例如: <form action="{php echo $this->createWebUrl($filename, array('op' => 'display'))}" class="form-inl 阅读全文
posted @ 2019-12-05 11:29 GetcharZp 阅读(388) 评论(0) 推荐(0)
摘要:JQuery 处理 微擎传递过去数据 PS:微擎得到的数据大多数是数组(我们这里处理数组) 将数组使用 json_encode() 函数处理成 JSON 格式 前端在 script 中使用 引号 将变量括起来即可得到后台设定的数据 使用 $.parseJSON() 函数转换成jquery可以处理的对 阅读全文
posted @ 2019-11-27 11:45 GetcharZp 阅读(233) 评论(0) 推荐(0)
摘要:微擎检验表单提交 checksubmit('submit') $_W['ispost'] $_W['isajax'] if (checksubmit('submit')) { exit('表单提交了'); }if ($_W['ispost']) { exit('post 方式提交');}if ($_ 阅读全文
posted @ 2019-11-27 09:44 GetcharZp 阅读(605) 评论(0) 推荐(0)
摘要:thinkphp在模板中使用php的函数 使用 {:函数名} 的形式 例如: // 获取 session 中存的值 {:session('admin.loginname')} // 输出当前日期 {:date('Y-m-d H:i:s', time())} 阅读全文
posted @ 2019-11-20 23:16 GetcharZp 阅读(546) 评论(0) 推荐(0)
摘要:thinkphp 5.1 去掉 .html 后缀 阅读全文
posted @ 2019-11-20 23:06 GetcharZp 阅读(538) 评论(0) 推荐(0)
摘要:thinkphp 6.0 在 initialize 中重定向无效 改用 header() 函数 实例: // header('location:/index.php/模块/控制器/方法'); header('location:/index.php/admin/login/login'); 阅读全文
posted @ 2019-11-16 13:54 GetcharZp 阅读(583) 评论(0) 推荐(0)
摘要:thinkphp 获取前端传递过来的参数 use think\facade\Request; // 获取当前请求的name变量 Request::param('name'); // 获取当前请求的所有变量(经过过滤) Request::param(); // 获取当前请求未经过滤的所有变量 Requ 阅读全文
posted @ 2019-11-15 23:15 GetcharZp 阅读(1486) 评论(0) 推荐(0)
摘要:PHP 发送get请求 file_get_contents 方法: $s = file_get_contents("http://apis.map.qq.com/ws/distance/v1/?mode=driving&from=30.56808,104.064305&to=30.5702,104. 阅读全文
posted @ 2019-11-14 16:34 GetcharZp 阅读(11330) 评论(0) 推荐(0)
摘要:微信开发者工具可以获取地址而手机上不能获取地址 原因: 未进行 wx.config 的配置; 解决方法: 传入对应的签名信息,对 wx.config 进行配置 参考文档 阅读全文
posted @ 2019-11-14 11:32 GetcharZp 阅读(496) 评论(0) 推荐(0)
摘要:微擎签名出错 错误信息: config:fail,Error: 系统错误,错误码:63002,invalid signature 修改方法: PHP 端 $account_api = WeAccount::create(); $jssdk = $account_api->getJssdkConfig 阅读全文
posted @ 2019-11-14 11:06 GetcharZp 阅读(2179) 评论(0) 推荐(0)
摘要:微擎 pdo_fetchall() 函数 注意点: 该函数内部直接执行原生 SQL 语句 如果在传递表名的时候使用了 tablename 。则不加 ims_ 前缀 参数的传递通过 :param 的形式 例子: 通过tablename指定表名: $qr = pdo_fetchall("SELECT ` 阅读全文
posted @ 2019-11-13 10:41 GetcharZp 阅读(2444) 评论(0) 推荐(0)
摘要:thinkphp6.0 多应用模块下提示控制器不存在 在项目根目录下使用Composer composer require topthink/think-multi-app 参考链接 阅读全文
posted @ 2019-11-13 00:02 GetcharZp 阅读(1358) 评论(0) 推荐(0)
摘要:thinkphp6.0 开启调试模式 首先确认自己是通过 composer 进行的下载,然后修改系统目录下的 .example.env 为 .env 文件 修改 config->app.php 的 ‘show_error_msg’ => true 使用模板报错 Driver [Think] not 阅读全文
posted @ 2019-11-12 22:41 GetcharZp 阅读(981) 评论(0) 推荐(0)
摘要:微擎使用腾讯地图拾取坐标 注意点: 传过去的backurl参数中,如果有 & 要将其替换成 %26,不然返回来的结果中不能识别调转链接 参考链接 示例代码: <div class="mui-input-row"> <label for="address">地址</label> <input type 阅读全文
posted @ 2019-11-11 18:58 GetcharZp 阅读(510) 评论(0) 推荐(0)
摘要:PHP 向数组头部插入数据 函数: array_unshift() 示例: $s = array('a' => 0, 'b' => 3); array_unshift($s, '5'); print_r($s); 阅读全文
posted @ 2019-11-08 11:24 GetcharZp 阅读(2395) 评论(0) 推荐(0)
摘要:微擎发送模板消息 参考链接 $openid = 'oXo3is-YksITdG35n4tTKBKog'; // “未处理消息提醒”消息模板 $tpl_id='G0_VQBsYx_iJKKkb3vj3_Y4D4mPPEyEYpmzT9rLT3b0'; //跳转链接 $url='http://www.b 阅读全文
posted @ 2019-11-06 12:11 GetcharZp 阅读(1352) 评论(0) 推荐(0)
摘要:LeetCode 35. 搜索插入位置 给定一个排序数组和一个目标值,在数组中找到目标值,并返回其索引。如果目标值不存在于数组中,返回它将会被按顺序插入的位置。 你可以假设数组中无重复元素。 示例 1: 输入: [1,3,5,6], 5输出: 2 知识点: array_search(); // 在数 阅读全文
posted @ 2019-11-05 20:49 GetcharZp 阅读(98) 评论(0) 推荐(0)
摘要:将 /u 转变为 utf-8 编码 PHP实例: $result = {"errno":-1,"message":"\u8bbf\u95ee\u5fae\u4fe1\u63a5\u53e3\u9519\u8bef, \u9519\u8bef\u4ee3\u7801: 40037, \u9519\u8 阅读全文
posted @ 2019-11-05 18:06 GetcharZp 阅读(587) 评论(0) 推荐(0)
摘要:PHP 富文本解码为 HTML 并显示 使用 html_entity_decode 函数 参考文档 PHP实例: // html_entity_decode(待解码内容, 如何处理引号) html_entity_decode($activity['content'], ENT_QUOTES) 阅读全文
posted @ 2019-11-05 17:09 GetcharZp 阅读(1258) 评论(2) 推荐(0)
摘要:LeetCode27. 移除元素 给定一个数组 nums 和一个值 val,你需要原地移除所有数值等于 val 的元素,返回移除后数组的新长度。 不要使用额外的数组空间,你必须在原地修改输入数组并在使用 O(1) 额外空间的条件下完成。 元素的顺序可以改变。你不需要考虑数组中超出新长度后面的元素. 阅读全文
posted @ 2019-11-04 23:24 GetcharZp 阅读(123) 评论(0) 推荐(0)