1事件分析要正确,确保程序第一步没有错误。
2无论先后echo的字符都会被浏览器当做html执行。
3数据库中的表连接:不要连进无用的表。
4选定的元素
在c shar 里是选定的对象的selected元素,在javascript是通过selectedindex和元素集合获得。(document.getelementbyid()。selectedindex)document。getelementbyid()。options/rowindex
脚本是宏。
5.net webform页面中只能有一个form表单
如果有一个服务器端,加一个客户端表单则会报回发参数错误。
6.ado.net读出的数据是object类型。在判断前先转换对应类型。
7.使用随机数生成集合下标时,注意用count-1。
8.一定注意大小写。
9.把调试用的方法函数全部删除后看效果,调试用的dump或echo本身可能造成bug。
序号$p=isset($_get['pagenum'])?$_get['pagenum']-1:0;
$_server['query_string'];url get参数字符串。
12、 find_in_set(str,strlist)
该函数用于判断 str 是否在strlist 中,如果是,作为条件,返回对应数据,如果str不在strlist或strlist为空字符串,则返回值为 0。
13 、group_concat(leader.name) group_concat()
官方:该函数返回带有来自一个组的连接的非null值的字符串结果。通俗点理解:group_concat()会计算哪些行属于同一组,将属于同一组的列按照一定的拼接规则拼接好显示出来。
形象的来说就是把列里的内容转化到了行里。
14 、按钮标签class等属性没有结束引号也会导致js失效。
15、ajax提交的页面代码有错误时,会报not found。
16、$.dialog()
function add(){
vardialog = $.dialog({
id:'add',
title:'添加打印机',
content:'url:__url__/addprinter/',
width:'800px',
lock:true,
parent:this
});
}
function editprinter(id)
{
vardialog=$.dialog({
id:'editprinter',
title:'修改打印机',
content:'url:__url__/printeredit/id/'+id,
windth:'800px',
lock:true,
parent:this
});
}
function del(id){
$.dialog.confirm('确定删除该条记录?',function(){
$.post(
'__url__/printdel/',
{id:id},
function(data){
if(data.state==1){
$("#hang_"+id).remove();
$.dialog.tips(data.info,'1','success.gif','');
}else{
$.dialog.alert(data.info,'',this);
}
}
);
});
}
17 curl
function curl_post($url, $post) {
// $post['dbname'] = get_global('zt');
$options = array(
curlopt_returntransfer => true,
curlopt_header => false,
curlopt_post => true,
curlopt_postfields => $post,
);
$ch = curl_init($url);
curl_setopt_array($ch, $options);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
18
select group_concat(p.name) as printnames,u.userid,u.truename,u.username from wms_user_info as u left join wms_printer p on find_in_set(p.id,u.printerids) and ( `status` = 0 ) group by u.userid limit 0,25
19
19、js访问父框架lhgdialog.min.js
var api = frameelement.api,w = api.opener;
w.document.getelementbyid('gys').value=truename;
w.document.getelementbyid('custom_id').value=cusid;
api.get(“”)以id搜寻父框架
20、正则表达式获得表名
if (preg_match('/FROM\s+([]0-9a-z_:"`.@[-]*)/is', $rs['sql'], $tableName)){
$tableName = $tableName[1];
}
21 、yii 分页
public function actionIndex()
{
$brand=new Brand();
$dataProvider = $brand->search();
$count=Brand::model()->count();
$page=new CPagination($count);
$page->pageSize=15;
$page->applyLimit($dataProvider->criteria);
$list=$brand->findAll($dataProvider->criteria);
return $this->render('index',array('list'=>$list,'pages'=>$page));
}
22、模糊查询:以大查小
SELECT * FROM sdb_brand where '苹果6' LIKE CONCAT('%',brand_name,'%') or brand_name LIKE '%果%'
SELECT * FROM sdb_brand where INSTR(brand_name,'苹果6') or brand_name LIKE '%果%'
23、TS和NTS
TS指Thread Safety,即线程安全,一般在IIS以ISAPI方式加载的时候选择这个版本。
NTS即None-Thread Safe,一般以fast cgi方式运行的时候选择这个版本,具有更好的性能。
24、js 页面加载完成事件
用 $(document).ready不要用直接在js标签中调用函数
<script> getOrders(1, 'goodarrearage',1);</script> 如引入相关的函数文件在此代码之后会出错。
$().on();可以解决。
25、日期间隔函数
date_sub(now(),interval 3month)
26 、遍历数组,调用用户函数
array_walk($deliver_info, function (&$row) {$row['time']=date('Y-m-d',$row['time']);});