Zend Studio 常用快捷键(2 位领导批示)

原文地址 http://www.zendstudio.net/component/ZendStudio-Shortcuts/

编辑功能

Ctrl + / 单行注释
Ctrl + Shift + / 块注释
Ctrl + U 选择的代码片段全部转换为大写
Ctrl + L 选择的代码片段全部转换为小写
Ctrl + D 复制光标所在行
Ctrl + E 删除光标所在行
Tab 增加代码缩进
Shift + Tab 减少缩进
Ctrl + Alt+ F 在文件中查找
Ctrl + BackSpace 删除光标前一个单词或一个符号
Ctrl + G 转到行
Alt + → 定位到光标的下一个位置
Alt + ← 定位到光标的上一个位置

环境切换

Esc 隐藏辅助窗口
Ctrl + W 切换自动换行
Ctrl + Tab 在各个编辑器标签页之间切换
Ctrl + F4 关闭当前标签页
Alt + F4 关闭ZDE

全文阅读 »

JS常用代码:五行搞定checkbox全选/全不选(0 位领导批示)

经常会用到的JS代码.记录一下.以后用得着

?View Code JAVASCRIPT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
p {margin:0;font-size:12px;line-height:26px;}
</style>
<script type="text/javascript">
function check_all(obj,cName)
{
	var checkboxs = document.getElementsByName(cName);
	for(var i=0;i<checkboxs.length;i++){checkboxs[i].checked = obj.checked;}
}
</script>
</head>
 
<body>
<p><input type="checkbox" name="all" onclick="check_all(this,'c')" />全选/全不选</p>
<p><input type="checkbox" name="c" value="" /></p>
<p><input type="checkbox" name="c" value="" /></p>
<p><input type="checkbox" name="c" value="" /></p>
<p><input type="checkbox" name="c" value="" /></p>
</body>
</html>

2008年CSS裸体日 俺博客自动脱光光 适用于各种PHP Blog(3 位领导批示)

今年的CSS Naked Day与往年推后了四天(4月9日)..

有些朋友已经迫不及待要让自己的网站裸奔了..

俺太懒.写几行代码.让俺的博客到时自己脱光光吧..

俺用的wordpress 同样适用于其它php博客

只需要css引用语句处加上如下代码:

1
2
3
4
5
6
7
8
9
<?php 
$NakedDay = date('md',time());//获得当前时间.用date函数格式化unix时间戳.
if($NakedDay != '0409')//判断当前日期.如果为0409就不执行
{
?>
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />//俺博客的样式表..
<?php 
}
?>

setcookie函数的作用域问题(0 位领导批示)

在不同目录下的文件.不能访问各自设置的cookie

查了一下手册.setcookie函数有一个path参数.可以设置本地cookie的作用域

解释如下:

The path on the server in which the cookie will be available on. If set to ‘/’, the cookie will be available within the entire domain . If set to ‘/foo/’, the cookie will only be available within the /foo/ directory and all sub-directories such as /foo/bar/ of domain . The default value is the current directory that the cookie is being set in.

另一个参数domain
则是设置网络上cookie的作用域.

解释如下:

The domain that the cookie is available. To make the cookie available on all subdomains of example.com then you’d set it to ‘.example.com’. The . is not required but makes it compatible with more browsers. Setting it to www.example.com will make the cookie only available in the www subdomain. Refer to tail matching in the » spec for details.

示例:

  1. $setcookday = 30;//设置cookie有效期
  2. setcookie('uname', '银子', time() + ($setcookday * 24 * 60 * 60),'/','qqdang.net'); //分别为cookie名称.cookie值.cookie有效时间.cookie本地作用域.cookie网络作用域

Discuz的install文件核心函数(2 位领导批示)

可以将自己写的程序做一个install.php.
Discuz的install文件中的核心函数,相当精简..

  1. <?php
  2. require("connect.inc.php");
  3. $sqlfile = 'test.sql';//sql文件
  4.  
  5. $fp = fopen($sqlfile, 'rb');
  6. $filesize=filesize($sqlfile);
  7. $sql = fread($fp, $filesize);
  8. fclose($fp);
  9. runquery($sql);
  10.  
  11. function runquery($sql) {
  12.     global $lang, $dbcharset, $tablepre, $db;
  13.  
  14.     $sql = str_replace("\r", "\n", str_replace(' cdb_', ' '.$tablepre, $sql));
  15.     $ret = array();
  16.     $num = 0;
  17.     foreach(explode(";\n", trim($sql)) as $query) {
  18.         $queries = explode("\n", trim($query));
  19.         foreach($queries as $query) {
  20.             $ret[$num] .= $query[0] == '#' || $query[0].$query[1] == '--' ? '' : $query;
  21.         }
  22.         $num++;
  23.     }
  24.     unset($sql);
  25.  
  26.     foreach($ret as $query) {
  27.         $query = trim($query);
  28.         if($query) {
  29.             if(substr($query, 0, 12) == 'CREATE TABLE') {
  30.                 $name = preg_replace("/CREATE TABLE ([a-z0-9_]+) .*/is", "\\1", $query);
  31.                 echo $lang['create_table'].' '.$name.' ... <font color="#0000EE">'.$lang['succeed'].'</font><br>';
  32.                 mysql_query(createtable($query, $dbcharset));
  33.             } else {
  34.                 mysql_query($query);
  35.             }
  36.         }
  37.     }
  38. }
  39. ?>

(备忘)MySQL字段类型(2 位领导批示)

MySQL支持大量的列类型,它可以被分为3类:数字类型、日期和时间类型以及字符串(字符)类型。本节首先给出可用类型的一个概述,并且总结每个列类型的存储需求,然后提供每个类中的类型性质的更详细的描述。概述有意简化,更详细的说明应该考虑到有关特定列类型的附加信息,例如你能为其指定值的允许格式。

由MySQL支持的列类型列在下面。下列代码字母用于描述中:

 

M
指出最大的显示尺寸。最大的合法的显示尺寸是 255 。
D
适用于浮点类型并且指出跟随在十进制小数点后的数码的数量。最大可能的值是30,但是应该不大于M-2。
方括号(“[”和“]”)指出可选的类型修饰符的部分。

注意,如果你指定一个了为ZEROFILL,MySQL将为该列自动地增加UNSIGNED属性。

全文阅读 »

Internet Explorer 8 Beta 1 发布(1 位领导批示)

Internet Explorer 8 can be installed on Microsoft Windows Vista® Service Pack 1 (SP1), Windows Vista, Windows XP® Service Pack 2 (SP2), Windows Server® 2008 and Windows Server 2003 Service Pack 2 (SP2).

能安装在vista,2008server,winXP SP2与2003 SP2上

不敢安装..怕折腾系统..^_^

M$总算知耻而后勇..

P.S.标准化的同学们..又要头大了吧.

Internet Explorer 8 Beta 1 下载页面 http://www.microsoft.com/windows/products/winfamily/ie/ie8/readiness/Install.htm

仿WINODWS警告提示Firefox广告(2 位领导批示)

不知道效果如何,先挂在自己的表情站上试试,毕竟google广告里最有价值的还是Firefox的广告推荐了

实现代码如下:

先在 < body > 后加上这么一段

  1. <div id="firefox">
  2. <a href="/firefox/" target="_new">还在用过时的IE浏览器?远离网络病毒,木马,恶意软件的入侵攻击,强烈建议下载安装【最快.最安全】的浏览器:火狐Firefox2.0</a>
  3. <img src="close.gif" id="foxclose" />
  4. </div>
  5. <script type="text/javascript" src="firefox.js"></script>

CSS部分:

  1. #firefox {
  2.     height:25px;
  3.     width:100%;
  4.     background:url(warning.gif) no-repeat 8px 3px #ffb;
  5.     border-bottom:1px solid #ffdb4d;
  6.     line-height:25px;
  7.     display:none;
  8. }
  9.  
  10. #firefox a {
  11.     color:#52271d;
  12.     float:left;
  13.     margin-left:170px;
  14. }
  15.  
  16. #firefox img {
  17.     dispaly:block;
  18.     float:right;
  19.     margin:7px 6px 0 0;
  20.     cursor:pointer;
  21. }

全文阅读 »

JS存档:insertAfter()函数(0 位领导批示)

insertAfter(newElement, targetElement)
newElement 创建的新元素
targetElement 插入到这个元素之后

JS没有内置这个函数真是不方便呐.存档方便今后查找

  1. function insertAfter(newElement, targetElement)
  2. {
  3.     var parent = targetElement.parentNode;
  4.     if(parent.lastChild == targetElement) 
  5.     {
  6.         parent.appendChild(newElement);
  7.     } 
  8.     else
  9.     {
  10.         parent.insertBefore(newElement, targetElement.nextSibling);
  11.     }
  12. }

JS中文字符串转换unicode编码函数(0 位领导批示)

AJAX传递中文字符串时必须把中文字符串编码成unicode,一般会用到JS的自带函数escape().不过找到了更好的函数来确决中文字符转换成unicode编码的函数

  1. function uniencode(text)
  2. {
  3.     text = escape(text.toString()).replace(/\+/g, "%2B");
  4.     var matches = text.match(/(%([0-9A-F]{2}))/gi);
  5.     if (matches)
  6.     {
  7.         for (var matchid = 0; matchid < matches.length; matchid++)
  8.         {
  9.             var code = matches[matchid].substring(1,3);
  10.             if (parseInt(code, 16) >= 128)
  11.             {
  12.                 text = text.replace(matches[matchid], '%u00' + code);
  13.             }
  14.         }
  15.     }
  16.     text = text.replace('%25', '%u0025');
  17.  
  18.     return text;
  19. }

当然服务器端要对编码过的字符串进行第二次转码.把字符串转换成UTF-8编码.

全文阅读 »

随机显示的10篇日志

评论最多的10篇日志

浏览最多的10篇日志