Comments (13)
Biny中没有sql文件这个概念 只需要在/app/config/dns_{env}.php(链接配置)中将数据库库信息配置好即可 表的话需要在dao目录下建立dao文件 或者 在/config/database.php 中建立表映射
初始代码中 应该没有sql语句 如果是你自己写的代码 可以在wiki中看看用法 http://www.billge.cc/#dao 有不清楚的我会解答
from biny.
我是不是可以这样理解,需要先自建表,然后“在/app/config/dns_{env}.php(链接配置)中将数据库库信息配置好即可 表的话需要在dao目录下建立dao文件 或者 在/config/database.php 中建立表映射”
from biny.
恩 是的
from biny.
OK,我创建试试。
from biny.
我建 了Biny_User 表,/login报错 什么问题?
Fatal error: method [updateByPk] not exists in [biny\lib\TXSingleDAO] in /Users/rjzou/workspace/php/Biny/lib/models/TXDAO.php:459 Stack trace: #0 /Users/rjzou/workspace/php/Biny/app/model/person.php(64): biny\lib\TXDAO->__call('updateByPk', Array) #1 /Users/rjzou/workspace/php/Biny/app/controller/loginAction.php(31): app\model\person->login() #2 [internal function]: app\controller\loginAction->action_index() #3 /Users/rjzou/workspace/php/Biny/lib/business/TXController.php(69): call_user_func_array(Array, Array) #4 /Users/rjzou/workspace/php/Biny/lib/business/TXController.php(42): biny\lib\TXController->call(Object(biny\lib\TXRequest)) #5 /Users/rjzou/workspace/php/Biny/lib/business/TXController.php(105): biny\lib\TXController->execute() #6 /Users/rjzou/workspace/php/Biny/lib/TXApp.php(177): biny\lib\TXController->dispatcher() #7 /Users/rjzou/workspace/php/Biny/web/index.php(21): TXApp::run() #8 {main}
from biny.
@rjzou class userDAO extends baseDAO
DAO文件需要自己创建或者配置映射关系
updateByPK用到数据库缓存的方法都在baseDAO里
from biny.
desc biny_user;
+----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+-------+
| id | int(11) | NO | PRI | NULL | |
| username | varchar(45) | YES | | NULL | |
+----------+-------------+------+-----+---------+-------+
2 rows in set (0.00 sec)
class userDAO extends baseDAO
{
protected $table = 'Biny_User';
protected $_pk = 'id';
protected $_username = 'username';
protected $_pkCache = true;
}
是这样映射吗?我接下来应该怎么使用?
from biny.
[ERROR]2018-09-30 10:33:00:936[::1] /favicon.ico
ERROR CODE: 2001
Action[favicon.icoAction] is not exists.
我新建了testDAO,和在config/database.php
return array(
'dbConfig' => array(
'test' => 'Biny_Test',
'user' => 'Biny_User'
)
);
Biny_Test表也建好了。
访问http://localhost:8080/test 还有这个错误?
from biny.
@rjzou 有userDAO.php文件就不需要在config里配置映射了
配置只是为了只需要基础功能的DAO而不想创建文件时准备的
另外 映射的DAO对象不包含baseDAO中提供的pk方法
具体DAO使用方法可以参考wiki: http://www.billge.cc/#dao-simple
from biny.
[ERROR]2018-09-30 10:33:00:936[::1] /favicon.ico
ERROR CODE: 2001
Action[favicon.icoAction] is not exists.
这个是因为服务器自己去找网站图标时候报错了 在/web/目录下放一个favicon.ico图标文件就行
其实就是这个
from biny.
谢谢,test可以查询出来了。
再问一下,修改了php文件要重启apache 才生效?
from biny.
不用 可能是你apache有缓存吧 看下配置把缓存关了吧
正常apache是不需要重启的
from biny.
修改php.ini opcache.enable=0 可以了。many thanks
from biny.
Related Issues (20)
- 数据库缓存的问题想请教一下 HOT 14
- Form的自定义验证问题 HOT 2
- 维护模式开启报错 HOT 1
- 403 Forbidden nginx HOT 4
- 部署在IIS7.5老是500错误 HOT 2
- Biny运行在PHP8.0 HOT 2
- Biny有更新版本计划吗? HOT 1
- Biny中如何将Token添加到请求头Header中? HOT 3
- 数据库操作 + - 不支持浮点数操作 HOT 3
- 请问,'not like' 要怎么写。 HOT 2
- DAO::get('xxx') 报错 HOT 2
- 我根据文档学着写restful API,但未能成功 HOT 6
- 加入Restful的OPTIONS默认回复200的开关 HOT 3
- 新建的Service没有生效 HOT 9
- 请问,使用虚拟主机无法指定 web 为根目录,如何修改? HOT 2
- 如何在Biny中实现JWT和JWE?
- 使用 axios 发送POST 请求时,无法正常接收到数据 HOT 2
- 在同一个方法中调用两个不同的$model 时, 后面的那个无法正常调用 HOT 5
- 反馈一个路由配置相关的Bug HOT 9
- 请问是否可以用swoole替代nginx作为服务器
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from biny.