演示thinkphp关联模型使用方法
tp3.2.3已经基本支持了关联模型的curd。
基本能投入使用,所以写了这个实例。
步骤: 解压文件夹到www目录
绑定测试域名到www/thinkphp/public
(一定注意,是绑定到public目录而不是根目录)
如果是linux,设置权限 chmod -r 777 www/thinkphp/data/runtime
导入数据库文件:www/thinkphp/data/db/thinkphp.sql到数据库
编辑www/thinkphp/app/common/conf/config.php配置数据库连接信息
浏览器访问测试域名,输出数据如下:array(2) {
[0] => array(7) {
[id] => string(1) 1
[name] => string(7) shellus
[email] => string(0)
[tel] => string(0)
[nick] => string(0)
[password] => string(16) shellus的密码
[document] => array(2) {
[0] => array(2) {
[title] => string(31) shellus的第一篇测试文章
[content] => string(40) shellus的第一篇测试文章的内容
}
[1] => array(2) {
[title] => string(31) shellus的第二篇测试文章
[content] => string(40) shellus的第二篇测试文章的内容
}
}
}
[1] => array(7) {
[id] => string(1) 2
[name] => string(12) 娃娃脾气
[email] => string(0)
[tel] => string(0)
[nick] => string(0)
[password] => string(15) 娃娃的密码
[document] => array(3) {
[0] => array(2) {
[title] => string(36) 娃娃脾气的第一篇测试文章
[content] => string(45) 娃娃脾气的第一篇测试文章的内容
}
[1] => array(2) {
[title] => string(36) 娃娃脾气的第二篇测试文章
[content] => string(45) 娃娃脾气的第二篇测试文章的内容
}
[2] => array(2) {
[title] => string(36) 娃娃脾气的第三篇测试文章
[content] => string(45) 娃娃脾气的第三篇测试文章的内容
}
}
}
}见:http://test.endaosi.com:8110/
欢迎提问。
demo.zip ( 2.51 mb 下载:99 次 )
ad:真正免费,域名+虚机+企业邮箱=0元