Example #1
0
 *
 *       Author: EricZhang
 *    Date Time: 1/18/16 1:34 PM
 * ====================================
 */
include_once "common.php";
class Client
{
    public static function main()
    {
        self::run(new MysqlFactory());
        self::run(new AccessFactory());
    }
    public static function run(IDBFactory $IDBFactory)
    {
        // User表
        $userName = '******';
        $user = $IDBFactory->createUser();
        $user->getDBType();
        $user->insertUser($userName);
        $user->getUser($userName);
        // department表
        $departName = "hahahaha";
        $department = $IDBFactory->createDepartment();
        $user->getDBType();
        $department->insertDepart($departName);
        $department->getDepart($departName);
    }
}
Client::main();
Example #2
0
 private function start()
 {
     $pid = $this->daemon();
     write_log('mq队列开始');
     while (true) {
         Client::main();
     }
     write_log('mq队列结束');
 }
Example #3
0
    include_once $className . ".php";
});
class Client
{
    public function main()
    {
        $piece = new Piece(new StateTwo());
        //Starts on One
        $piece->moveDown();
        //Goes to Three
        $piece->moveRight();
        //Goes to Four
        $piece->moveUp();
        //Goes to Two
        $piece->moveLeft();
        //Goes to One
        $piece->moveLeft();
        //Error
        $piece->moveLeft();
        //Error
        $piece->moveUp();
        //Error
        $piece->moveRight();
        //Goes to Two
        $piece->moveUp();
        //Error
    }
}
$client = new Client();
$client->main();
Example #4
0
/**
 * 程序入口
 */
function start()
{
    $client = new Client();
    $client->main();
}
Example #5
0
 private function start()
 {
     $pid = $this->daemon();
     Client::main();
 }