PHP中删除变量时unset()和null的区别

| December 19, 2008 18:57 | root | Via 本站原创
第一种方法:$varname=null
第二种方法:unset($varname)
代码:
<?php
$a = array(
    'a' => 'a',
    'b' => 'b'
);
$b = array(
    'a' => 'a',
    'b' => 'b'
);
$a['b'] = null;
unset($b['b']);
print('<pre>');
print_r($a);
print('<br />');
print_r($b);
print('</pre>');
?>

结果:
Array
(
    [a] => a
    =>
)
Array
(
    [a] => a
)
访问世纪流年BLOG站时看到的一段文字,对设计模式的解释很风趣,能够让人很快的了解其含义,学到了不少东西,以下是文章的内容:

对设计模式很有意思的诠释,呵呵,原作者不详。
我来添加一句:世纪流年就是现在thinkPHP的原作者,我读大学的时候找他要到过前世纪流年BLOG站的模板!

Linux查看网络流量的脚本

| December 19, 2008 11:26 | root | Via 本站原创

# cat stream


#! /bin/bash

# Write by Neil.xu qq:37391319 email: xurongzhong@gmail.com

# 2008-8-19 we need to monitor streams of LTS channels, so write this script

typeset in in_old dif_in dif_in1 dif_out1
typeset out out_old dif_out

in_old=$(cat /proc/net/dev | grep eth0 | sed 's=^.*:==' | awk '{ print $1 }' )
out_old=$(cat /proc/net/dev | grep eth0 | sed 's=^.*:==' | awk '{ print $9 }')

while true
do
         sleep 1
         in=$(cat /proc/net/dev | grep eth0 | sed 's=^.*:==' | awk '{ print $1 }')
         out=$(cat /proc/net/dev | grep eth0 | sed 's=^.*:==' | awk '{ print $9 }')
         dif_in=$((in-in_old))
         dif_in1=$((dif_in * 8 / 1024 / 1024 ))
         dif_out=$((out-out_old))
         echo " IN: ${dif_in} bytes OUT: ${dif_out} bytes "
         dif_out1=$((dif_out * 8 / 1024 / 1024 ))
         echo "IN: ${dif_in1} mbps OUT: ${dif_out1} mbps"
         in_old=${in}
         out_old=${out}
done

XWinLogon Win32 X-Server如何启动gnome?

| December 19, 2008 11:22 | root | Via 本站原创
startkde :可以成功.请教: 为什么startx不能起? gnome-session   &

教你在Linux用飞信(fetion)免费发短信,命令行。。。

| December 18, 2008 15:38 | root | Via 本站原创
最近在做公司的服务器网络监控。由于要做到实时监控,所以想到要用发送短信到手机的方式。在网上找到一个linux命令行下的飞信工具。来配合 nagios做监控。服务器有任何状况都可以发送短信到手机上。这样对于系统管理者来说很是方便。我在Debian和Ubuntu下测试成功。下面是飞信在debian系统的安装过程。

1.首先手机要开通中国移动的飞信业务。目前使用飞信发送短信是免费的。

2.下载飞信的linux客户端程序.解开包后只有一个文件sms。不错。这个就是飞信发送短信的程序啦。现在的飞信还是不能用的。因为它需要libace的glibc库的支持。
分页: 7/162 第一页 上页 2 3 4 5 6 7 8 9 10 11 下页 最后页 [ 显示模式: 摘要 | 列表 ]