摘要:
query 用于查询 其他的用execute插入记录 $result = Db::execute('insert into sb_ad (ad_name, ad_content ,status) values (1, "456",1)');dump($result); 更新记录$result = D 阅读全文
文章分类 - thinkPHP
tp5 数据库增加
2020-11-28 14:14 by idea555, 96 阅读, 收藏, 编辑
摘要:
$password = md5('admin888'); $time = date('Y-m-d H:i:s', time()); $sql = "insert into news (Title,CreateTime) values ('标题五','$time')"; $status = Db::e 阅读全文
tp 遍历数据库表
2020-11-28 11:52 by idea555, 207 阅读, 收藏, 编辑
摘要:
$sql = "select * from news"; $data = Db::query($sql); foreach ($data as $key => $value) { echo $key . '<br>'; print_r($value); echo '<br>'; foreach ($ 阅读全文
TP5控制器中使用视图的三种方法
2020-11-28 10:22 by idea555, 1048 阅读, 收藏, 编辑
摘要:
1、直接实例化视图类 1、视图类: thinkphp/library/think/View.php;2、命名空间: use think\View;3、实例化: 动态 new View(); 静态 View::instance();4、常用方法: fetch()渲染模板, display()渲染内容, 阅读全文
thinkphp5 第2课:使用tp5输出hello world
2020-11-28 09:59 by idea555, 316 阅读, 收藏, 编辑
摘要:
首次安装完tp5,运行http://127.0.0.1/tp5/public/index.php 结果如下: 如何输出hello world呢,我们该从何处入手呢? 首先,我们打开public目录下的index.php文件,只有两行代码: // 定义应用目录 define('APP_PATH', _ 阅读全文