Submitted by shqzzy on 2007, July 13, 4:37 PM
调用的静态方法 Static class method call
call_user_func 的方法调用. 我遇到一个地方不能理解.
mixed call_user_func ( callback function [, mixed parameter [, mixed ...]] )
明明第一个参数是 function .可为什么可以接收一个array参数呢
<?php
class MyClass{
function s($i)
{
echo $i;
}
}
$c=new MyClass();
call_user_func(array($c,'s'),2);
?>
去官方找到一些答案了.
» 阅读全文
Tags: call_user_func, callback
技术文章 | 评论:0
| Trackbacks:0
| 阅读:4259
Submitted by shqzzy on 2007, July 13, 12:54 PM
Tags: 随机, rnd()
技术文章 | 评论:1
| Trackbacks:0
| 阅读:3504
Submitted by shqzzy on 2007, July 12, 4:33 PM
如果使用DOMXPath 获得返回是DOMNodelist.
可以使用foreach(nodes as node)
获得属性可以 node->getAttribute("code")
获得值可以 node->nodeValue
如何不用foreach 如何获得
» 阅读全文
Tags: domnodelist, nodevalue
技术文章 | 评论:0
| Trackbacks:0
| 阅读:3032
Submitted by shqzzy on 2007, July 12, 6:57 AM
The subject of polymorphism is probably the most important in OOP. Using classes and inheritance makes it easy to describe a real-life situation as opposed to just a collection of functions and data. They also make it much easier to grow projects by reusing code mainly via inheritance. Also, to write robust and extensible code, you usually want to have as few as possible flow-control statements (such as if() statements). Polymorphism answers all these needs and more.
Consider the following code:
» 阅读全文
技术文章 | 评论:1
| Trackbacks:0
| 阅读:4592
Submitted by shqzzy on 2007, July 12, 12:28 AM
You are probably asking yourself if this whole static business is really useful.
One example of using it is to assign a unique id to all instances of a class:
class MyUniqueIdClass {
static $idCounter = 0;
public $uniqueId;
function __construct()
{
self::$idCounter++;
$this->uniqueId = self::$idCounter;
}
}
$obj1 = new MyUniqueIdClass();
print $obj1->uniqueId . "\n";
$obj2 = new MyUniqueIdClass();
print $obj2->uniqueId . "\n";
» 阅读全文
Tags: singleton, 设计模式
技术文章 | 评论:0
| Trackbacks:0
| 阅读:3021
Submitted by shqzzy on 2007, July 8, 4:33 PM
ctype_alnum() Check if a value contains only alphanumeric characters.
ctype_alpha() Check if a value contains only alphabetic characters.
ctype_digit() Check if a value contains only numeric characters.
ctype_print() Check if a value contains only printable characters.
ctype_space() Check if a value contains only white space characters.
» 阅读全文
Tags: ctype, 过滤, 验诈
技术文章 | 评论:1
| Trackbacks:0
| 阅读:3623
Submitted by shqzzy on 2007, July 6, 9:53 PM
LAMP(Llinux,Apache,mysql,php)
» 阅读全文
Tags: lamp
技术文章 | 评论:0
| Trackbacks:0
| 阅读:3006
Submitted by shqzzy on 2007, July 6, 11:08 AM
刚学php,发现正则一直在使用 ereg. 可就是不支持 \d 好奇怪
在QQ群一问,他们说要使用preg函数才支持全面正则.
下面是在网站的一些文章.
http://cn.php.net/manual/zh/ref.pcre.php
http://blog.csdn.net/TruthTracer/archive/2006/03/14/624061.aspx
» 阅读全文
技术文章 | 评论:0
| Trackbacks:0
| 阅读:2817