问 题
TP5 之前的做法:
//创建数据库
$dbconfig['DB_TYPE']="mysql";
$dbconfig['DB_HOST']=I('post.dbhost');
$dbconfig['DB_USER']=I('post.dbuser');
$dbconfig['DB_PWD']=I('post.dbpw');
$dbconfig['DB_PORT']=I('post.dbport');
$db = Db::getInstance($dbconfig);
$dbname=strtolower(I('post.dbname'));
$sql = "CREATE DATABASE IF NOT EXISTS `{$dbname}` DEFAULT CHARACTER SET utf8";
$db->execute($sql) || $this->error($db->getError());
// 这边做了一次渲染的动作
$this->display(":step4");
//创建数据表
$dbconfig['DB_NAME']=$dbname;
$dbconfig['DB_PREFIX']=trim(I('post.dbprefix'));
$db = Db::getInstance($dbconfig);
$table_prefix=I("post.dbprefix");
sp_execute_sql($db, "thinkcmf.sql", $table_prefix);
TP5的做法:
//创建数据库
$dbconfig['DB_TYPE']="mysql";
$dbconfig['DB_HOST']=I('post.dbhost');
$dbconfig['DB_USER']=I('post.dbuser');
$dbconfig['DB_PWD']=I('post.dbpw');
$dbconfig['DB_PORT']=I('post.dbport');
$db = Db::getInstance($dbconfig);
$dbname=strtolower(I('post.dbname'));
$sql = "CREATE DATABASE IF NOT EXISTS `{$dbname}` DEFAULT CHARACTER SET utf8";
$db->execute($sql) || $this->error($db->getError());
// 这边直接return了
return view("step4");
//创建数据表
$dbconfig['DB_NAME']=$dbname;
$dbconfig['DB_PREFIX']=trim(I('post.dbprefix'));
$db = Db::getInstance($dbconfig);
$table_prefix=I("post.dbprefix");
sp_execute_sql($db, "thinkcmf.sql", $table_prefix);
问题就是:
现在的TP5的渲染直接return了当前的控制器,如果我有很多步骤要执行,该如何处理?
请问有什么解决方案吗?
解决方案
-!自己解决了:
使用<<< 将html原样输出
用echo $this->display($html)渲染内容即可。
扫一扫关注IT屋
微信公众号搜索 “ IT屋 ” ,选择关注与百万开发者在一起