摘要:
PHP把所有以__(两个下划线)开头的类方法当成魔术方法。所以你定义自己的类方法时,不要以 __为前缀。// __toString、__set、__get__isset()、__unset()/* The __toString method allows a class to decide how it will react when it is converted to a string. __set() is run when writing data to inaccessible members. __get() is utilized for reading data from in 阅读全文
摘要:
1)使用sed命令快速得到一个文件第一行内容sed -n '1'p file 这条语句可以实现这个需求,但是这个文件如果有百万条数据,这样性能上会有问题。解决办法:代码 sed -n '1p;1q' file这条命令将只输出第一行,同时退出程序。linux下经常man command是个好习惯。2)磁盘使用率偏大,需要察看哪个文件或目录占用空间最大du -sm * | sort -nrdu参数-s, --summarize display only a total for each argument-m like --block-size=1Msort参数-n, 阅读全文