notepad++插件大全

Explorer 资源管理器
Colour Picker 拾色器
SecurePad 加密工具
HTMLTag
NppExport 导出为特殊格式
Simple script
AHKExtLexer
Analyse Plugin 分析
AutoSave 自动保存
AwkPlugin
CCompletion 代码自动完成
code alignment 代码自动对齐

Read More

setTimeout()实现程序每隔一段时间自动执行

定义和用法
setTimeout() 方法用于在指定的毫秒数后调用函数或计算表达式。
语法
setTimeout(code,millisec)

参数 描述
code 必需。要调用的函数后要执行的 JavaScript 代码串。
millisec 必需。在执行代码前需等待的毫秒数。

提示和注释
提示:setTimeout() 只执行 code 一次。如果要多次调用,请使用 setInterval() 或者让 code 自身再次调用 setTimeout()。

Read More

php empty()和isset()的区别

在使用 php 编写页面程序时,我经常使用变量处理函数判断 php 页面尾部参数的某个变量值是否为空,开始的时候我习惯了使用 empty() 函数,却发现了一些问题,因此改用 isset() 函数,问题不再。

顾名思义,empty() 判断一个变量是否为“空”,isset() 判断一个变量是否已经设置。正是这种所谓的“顾名思义”,令我开始时走了些弯路:当一个变量值等于0时,empty()也会成立(True),因而会发生 一些意外。原来,empty() 和 isset() 虽然都是变量处理函数,它们都用来判断变量是否已经配置,它们却是有一定的区别:empty还会检测变量是否为空、为零。当一个变量值为0,empty() 认为这个变量同等于空,即相当于没有设置。

比如检测 $id 变量,当 $id=0 时,用empty() 和 isset() 来检测变量 $id 是否已经配置,两都将返回不同的值—— empty() 认为没有配置,isset() 能够取得 $id 的值:

1
2
3
4
5
6
$id=0;  
empty($id)?print "It's empty .":print "It's $id .";
//结果:It's empty .
print "<br>";
!isset($id)?print "It's empty .":print "It's $id .";
//结果:It's 0 .

Read More

开启PHP错误提示配置步骤详解

PHP编码出错不提示,这对于开发来说,是很不方便的。下面讲解如何开启错误提示步骤:

1.打开php.ini文件。
以我的ubuntu为例,这个文件在: /etc/php5/apache2 目录下。

2.搜索并修改下行,把Off值改成On
display_errors = Off

3.搜索下行
error_reporting = E_ALL & ~E_NOTICE
或者搜索:
error_reporting = E_ALL & ~E_DEPRECATED
修改为
error_reporting = E_ALL | E_STRICT

Read More

给js创建的一个input数组绑定click事件

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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<html>  
<body>
<input type="button" name="input[]" value="按钮1" />
<br />
<input type="button" name="input[]" value="按钮2" />
<br />
<input type="button" name="input[]" value="按钮3" />
<br />
<div id="add">
</div>
</body>
</html>

<script type="text/javascript">
// 通过 getElementsByTagName 获得都有 input 控件
var inputs = document.getElementsByTagName("input");
// 为第0个button绑定onclick事件,alert一下
inputs[0].onclick = function() {
alert("我测试一下");
}

// 为每一个button绑定onclick事件,alert一下
for (var i = 0; i < inputs.length; i++) {
inputs[i].onclick = function() {
alert("我测试一下");
}
}

window.onload = function() {
// 定义一个数组 arrs
var arrs = new Array();
// 循环添加
for (var i = 0; i < 2; i++) {
// 循环添加两个 input type="button" value="新增"+i
var input = document.createElement("input");
input.type = "button";
input.value = "新增" + i;
// 记得把创建的 input 放入 arrs 中
arrs.push(input);
// 然后把 input 放入 id="add" 的div中
document.getElementById("add").appendChild(input);
}

// 同样用 [0].onclick 绑定事件,依然没有问题
arrs[0].onclick = function() {
alert("我又测试一下");
}

}
</script>