随手笔记

来源:互联网 发布:医疗人工智能 编辑:程序博客网 时间:2024/04/30 11:01

1。你知道thinkphp的{if condition="$name eq '11'"}嵌套最多两层

2.  用isset方法对$_post[name],使用会为真,而不是你想的空。

2.读取数据库形成导航栏存入缓存。

$Sitecache = array();$list = M('sys_dir')->where("fid = 2")->select();foreach ($list as $key => $value) {$Sitecache[$key]['firstsite'] = $value['value'];$Sitecache[$key]['firstimg'] = $value['remark'];$listc = M('sys_dir')->where("fid = ".$value['id'])->select();$secondsite = array();foreach ($listc as $k => $v) {array_push($secondsite, array('secondvalue'=>$v['value'],'secondname'=>$v['name']));}$Sitecache[$key]['secondsite'] = $secondsite;}dump($Sitecache);cache('Usite',$Sitecache);

3.读取导航栏显示目录

1

{php}$usite = cache('Usite');$ucsite = $usite['menu'];{/php}{volist name="ucsite" offset="4" id="vo"}1*{$vo.v}<br/>{volist name="vo" offset="4" id="po"}2*{$po.v}<br>{volist name="po" offset="4" id="mo"}3*{$mo.v}<br>{/volist}{/volist}{/volist}

4.js的对form的验证

<form action="" name="form1" method="post" onsubmit="return check_form()"></form>
<script>function check_form(){var frm = document.forms['form1'];var oldpassword = frm.elements['oldpassword'].value;var newpassword = frm.elements['newpassword'].value;var newpassword1 = frm.elements['newpassword1'].value;var errorMsg = '';if (oldpassword.length == 0 ) {errorMsg += '* 请输入旧的登录密码' + '\n';}if (newpassword.length == 0 ) {errorMsg += '* 新密码不能为空' + '\n';}if (newpassword.length>15 || newpassword.length<6 ) {errorMsg += '* 新密码长度在6到15之间' + '\n';}if (newpassword.length !=newpassword1.length) {errorMsg += '* 两次密码长度不一样' + '\n';}if(newpassword!=newpassword1){errorMsg += '* 两次密码不一样' + '\n';}if (errorMsg.length> 0){alert(errorMsg); return false;} else{  return true;}}</script>


5.访问www.daiab.com时出现错误,调试聊很久无法解决,总是找不到服务。后来吧<? ?>改为<?php ?>可以访问但是会一直报权限错误,最后发现时php的一个拓展没有

加,short open tag,这个拓展可以正常编译<? echo "hello" ?>的编写方式。



原创粉丝点击