小程序开通wx.chooseAddress、wx.getLocation后还要在APP.JSON里配置
"requiredPrivateInfos":["getLocation","chooseAddress"],
关于微信小程序POST请求的方法,和GET不同
wx.request({ url: 'http://www.dnwfb.com', // 仅为示例,并非真实的接口地址 method: 'post', data: { //所需要参数 //其中that.data.username是在wx.request请求外就写好的数据 that.data.password也一样 username: that.data.username, password: that.data.password }, //请求头 注:在get请求中可有可无,但post需要 header: { 'content-type': 'application/x-www-form-urlencoded' // 默认值 }, success(res) { console.log(res.data) } })
笔记-ReflectionFunction查找function位置功能,PHP很牛的一个功能!必须记下!
function fun(){ echo '我在这里'; } $func = new ReflectionFunction('fun'); $a['file'] = $func->getFileName(); $a['start'] = $func->getStartLine(); $a['end'] = $func->getEndLine(); var_dump($a);
PHP函数,记录自己写的一个删除文件及文件夹的函数,相对比较精简好用!
function del($dir){ if(!is_dir($dir)) return false; if($opendir=opendir($dir)){ while(($file=readdir($opendir))!==false){ if($file!=='.' && $file!=='..'){ $filename=$dir.'/'.$file; is_dir($filename) ? readir($filename) : unlink($filename); } } } closedir($opendir); return rmdir($dir); }
http_build_query可以将数组拼接为URL的一个PHP函数!
http_build_query()$site=['name'=>'电脑屋','url1'=>'dnwfb.com','url2'=>'www.dnwfb.com'];
Mysql用select查询文章ID的上一篇和下一篇的方法!
select * from t_article where id = (select id from t_article where id < 4 order by id desc limit 1);
PHP用curl访问域名的一个函数,记录一下,以防以后用到!
function GetCurl($url){ $curl = curl_init(); curl_setopt($curl,CURLOPT_RETURNTRANSFER,1); curl_setopt($curl,CURLOPT_URL, $url); curl_setopt($curl,CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); $resp = curl_exec($curl); curl_close($curl); return $resp; }
E站群系统模板制作标签调用整理!更新中……
网站标题 <?=$site['name']?> 网站关键字 <?=$site['key']?> 网站描述 <?=$site['desc']?> 调用栏目 <?php foreach($nav as $k=>$v):?> <?=$v[url]?> <?=$v[id]?>,<?=$v['name']?> 调用简介 <?=incsdk(array('classid'=>'2'),navtext)?> 字符截取 <?=sub(要截取的字符调用,截取字数)?> 按栏目ID调用 <?php foreach(sslist('栏目ID','调用条数','页数0','是否缩略图1代代开启','调用推荐0/1','头条0/1') as $k=>$v):?> 搜索词调用 <?php foreach(hot(8) as $v):?><a href="<?=$v['url']?>" title="<?=$v['key']?>" > 友情链接调用 <?php foreach(links(可填友情链接分类ID) as $v):?> $v['lname'] $v['lurl'] 模板目录 <?=$dir?> 自动加载PHP /?inc=dnwfbcom 等号后面是模板目录/include文件夹下的PHP文件名(不包括后辍) 调用淘客列表 <?php foreach(tao_list($con['pagekey'][0],显示条数) as $v):?> 淘客转链 <?=tao_links(淘客的goodsId,q)?> q为券链接,t为淘链接,k为淘口令
如何让input字段提示不能为空,JS实现不如用required
<form name=alipayment action=pay.php method=post target="_blank"> <input type="text" id="money" name="money" value="" placeholder="请输入金额" autocomplete="off"> </form> <script type="text/javascript"> function checkform(){ var name= document.getElementById('money'); if(name.value.length==0){ alert('输入为空!'); } } </script>
PHP加密解密函数,可用来网站授权等操作!
function decode($string,$key = 'DLKLA;RR9TJ:fQGl5:gotoJ1LuC;O5xC3:Z53HU:gotoVcxQN') { $key = md5($key);
让HTML表单不可修改,只能默认的方法!disabled和readonly
当然有的时候表单是要提交传值 的,而disabled是不支持POST传参的,那就要用到 readonly="",经测试,将disabled改为readonly后就可以传参了!
帝国灵动标签调用标题分类和链接的方法!
[e:loop={0,6,3,0}] <a href="<?=sys_ReturnBqInfoTypeUrl($bqr[ttid])?>" >[<?=$class_tr[$bqr[ttid]][tname]?>]</a> <a href="<?=$bqsr['titleurl']?>" title="<?=$bqr['title']?>"><?=$bqr['title']?></a> [/e:loop]
几种js点击复制代码
<div id="text">被复制的文字</div> <style type="text/css"> #input {position: absolute;top: 0;left: 0;opacity: 0;z-index: -10;} </style> <textarea id="input">已经被隐藏</textarea> <div onclick="copyText()">点击复制</div> <script type="text/javascript"> function copyText() { var text = document.getElementById("text").innerText; var input = document.getElementById("input"); input.value = text; // 修改文本框的内容 input.select(); // 选中文本 document.execCommand("copy"); // 执行浏览器复制命令 alert("复制成功"); } </script>