V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  yakczh  ›  全部回复第 53 页 / 共 70 页
回复总数  1391
1 ... 49  50  51  52  53  54  55  56  57  58 ... 70  
没有映射,耦合性就太强了,要么在表单域的名字全部与数据库表字段一致,要么在controll/route里面挨个赋值 $data = array(
'user_login' => Input::get('f1'),
'user_password' => Input::get('f3'),
'user_email' => Input::get('f2'),

);
然后按表字段来验证
$rules= array(
'user_login' => 'required',
'user_password' => 'required|min:8',
'user_email' => 'required|email|unique:users'
);
$validator = Validator::make($data, $rules);
但这样验证出错信息里是表字段为键
Array ( [*messages] => Array ( [user_login] => Array ( [0] => The user login field is required. ) [user_password] => Array ( [0] => The user password field is required. ) [user_email] => Array ( [0] => The user email field is required. ) ) [*format] => :message )
前台在显示错误提示的时候 只显示The following errors have occurred: 但不会显示具体那个字段出错了,因为找不到对应的键,除非用
{{ $errors->first('user_login', '<li>:message</li>') }}
{{ $errors->first('user_password', '<li>:message</li>') }}
{{ $errors->first('user_email', '<li>:message</li>') }} 再把数据库表名全部列上去,这样就跟第一种方式一样了
@huafang 怎么写
比如 表单是 f1 => users_login
f2 =>users_pass
f3 =>users_mail

$rules= array(
'f1' => 'required',
'f2' => 'required|min:8',
'f3' => 'required|email|unique:users'
);
这里怎么配置?
$rules= array(
'username' => 'required',
'password' => 'required|min:8',
'email' => 'required|email|unique:users'
);

比如表单是email, 数据库青字段可能是 users_mail 这种的, 提交的时候提示
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'email' in 'where clause' (SQL: select count(*) as aggregate from `users` where `email` = [email protected])
2014-04-08 17:27:49 +08:00
回复了 yakczh 创建的主题 Python 处女座还真的适合写 python
看豆瓣的页面源码就知道这是处女座干的
2014-04-08 08:40:40 +08:00
回复了 ygtq 创建的主题 程序员 怎么做服务端目录浏览?
@ygtq

path='.\*'
for fn in glob.glob(path):
print(fn)
2014-04-07 22:16:36 +08:00
回复了 wangyongbo 创建的主题 Python python 程序员 混的社区
python是小众还是大众?
2014-04-07 21:17:04 +08:00
回复了 wangyongbo 创建的主题 Python python 程序员 混的社区
v2ex
2014-04-07 15:34:47 +08:00
回复了 ygtq 创建的主题 程序员 怎么做服务端目录浏览?
glob
2014-04-07 08:38:46 +08:00
回复了 yakczh 创建的主题 Python python -m SimpleHTTPServer 有没有参数可以切换 DocumentRoot
找到一款nodejs写的 
npm install http-server -g
nodejs http-server .  #当前目录做根目录 
nodejs http-server e:\www #指定目录

这个对中文支持要好得多   SimpleHTTPServer 显示中文文件全是方块
技术人员没有价值观,最终就伦为工具,用来当炮灰
2014-04-05 15:17:58 +08:00
回复了 yueyoum 创建的主题 程序员 如何实现一个高性能的 http 请求分发服务
第一次给客户端写个cookie,下次请求过来直接取出http头,做相应的转发,用nodejs就几行代码就搞定了 这种场景应该才是nodejs能派上用场的地方,可惜很多人都在用nodejs在那里绕圈圈地查数据库写数据库 只是为了证明"我能,我行"
2014-04-02 20:40:10 +08:00
回复了 kurtis 创建的主题 程序员 有没有发现,越有经验的程序员反而代码速度越慢?
所以你看招聘广告都是招1-2年经验的,这样开发项目才"觉"得快
检测ua,如果是手机,换个模板不就完了吗,这有什么头疼的?
2014-03-30 11:32:43 +08:00
回复了 spoonwep 创建的主题 程序员 为了提高工作效率,大家是怎么处理桌面成堆的窗口的?
让老板买两台显示器,一台写代码,一台显示结果
2014-03-29 22:04:51 +08:00
回复了 xiaop 创建的主题 程序员 PHPWIND 官网又被黑了,全挂了一个游戏网站的链接。
http://www.phpwind.com/index.php?m=download 显示 无法连接到数据库: 172.18.120.167:3307
2014-03-27 20:15:53 +08:00
回复了 kingwon 创建的主题 程序员 sublime text 3 less 插件装了不可用,求解?
sublime有没有插件,可以左面写html,右面预览效果的?
@zztt168  我在wp后台添加了 Meteor Slides 这个slide,也上传了图片,怎么样操作才能显示在首页?
@Mihuwa wordpress 样式调起来很麻烦
@hermitu 就象这样的,后台看了一个好象不支持图片上传,需要把编辑器换掉 
记得以前有一个类似这样的开发的博客,很久了现在搜索找不到了
1 ... 49  50  51  52  53  54  55  56  57  58 ... 70  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2584 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 33ms · UTC 14:55 · PVG 22:55 · LAX 07:55 · JFK 10:55
Developed with CodeLauncher
♥ Do have faith in what you're doing.