Tag Archives: tip

PHP备忘

1,stdClass 他是php内置的一个类,提供给我们直接实例化使用。 $obj = new stdClass();$obj->prop = ‘hello world’;echo $obj->prop; 我们可以看看他的内部结构 Reflection::export(new ReflectionClass(‘stdClass’));/* 输出结果Class [ <internal> class stdClass ] {  – Constants [0] {  }  – Static properties [0] {  }  – Static methods [0] {  }  – Properties [0] {  }  – Methods [0] {  }}</internal>*/ 2,php的exception和error处理 他们各自的发生: exception可以通过php5 的try{}抛出,然后通过catch{}被捕获。 php内置函数执行时发生问题,是通过trigger_error显示error。 使用异常: <?php// 定义未捕获异常的处理函数function [...]

Page 1 of 1 1