Example #1
0
//你应该在.h文件顶部放入如下信息,然后在命令行执行 php Pods/TeemoV2/TModel.php
//你可以将必要的信息放置在Pods/TeemoV2/cookie/目录下
//比如,需要在bbs.duowan.com域下传输指定cookie信息,则在cookie目录下放置一个文件名为bbs.duowan.com的文件,文件内容为cookie
//若PostData:为空,则为GET方式获取示例数据,格式如下PostData:id=123&name=你妹&sex=male
//【你也可以在h文件的目录下放置同名的.json后缀文件,程序将以此json文件内容为准,生成对应的数据结构】
/**
 *  TModel
 *  Url:http://duanzi.duowan.com/index.php?r=duanzi/topicList&page=1&pageSize=10&type=1&sort=2
 *  PostData:
 *  Usage: Open Terminal -> cd $projectDir -> php Pods/TeemoV2/TModel.php -> Done!
 *  Note that your project directory must Writeable -> sudo chown -R (User) ./
 */
//  These Code Is Generate By TModel cuiminghui@yy.com
$m = new TModel();
$m->scan();
$m->tryFetch();
class TModel
{
    private $_Files = array();
    public function scan($dir = './')
    {
        $fileList = scandir($dir);
        foreach ($fileList as $fileItem) {
            if ($fileItem == '.' || $fileItem == '..') {
                continue;
            } elseif (is_dir($dir . $fileItem)) {
                $this->scan($dir . $fileItem . '/');
            } else {
                $this->checkFile($dir . $fileItem);
            }
        }