1,新建一个Controller,如ReplController.class.php
<?php namespace Home\Controller; use Think\Controller; class ReplController extends Controller { function index() { $Boris = new \Behavior\BorisBehavior(); $Boris ->run(); }
2,使用命令行进入repl模式
php index.php Repl
使用效果如下
➜ thinkphp git:(master) ✗ php index.php REPL MODE FOR THINKPHP THINKPHP_VERSION: 3.2.3beta, PHP_VERSION: 5.5.14, BORIS_VERSION: 1.0.8 [1] >>> $model = D("UserActLog"); // object(Home\Model\UserActlogModel)( // // ) [2] >>> $model->count(); // 1322112 [3] >>> $model->_sql(); // 'kingsgame.user_act_log.count()' [4] >>> A("Index")->hello(); Hello world// NULL [5] >>>