August 24, 2016
PHP: 在类(class)中加载动态函数, 变量函数或半变量函数 variable function/method
最终实例在下方
以前用过cakephp, 他们的数据库查询还是蛮强大的, 后来好奇它的类的写法,比如:
<?php
$this->Post->findByTitle('My First Blog Post');
$this->Author->findByLastName('Rogers');
findBy<fieldName>
string $value
findAllBy<fieldName>
string $value
findAllBy 或者 findBy 后面可以跟变量, 它大概的方法就是使用了三个核心内置函数: __call, method_exists() 和 call_u… Read More