关于setting页面的action问题
我现在要修改自定义的头像,代码里的action地址是',$_SERVER["REQUEST_URI"],'#2。php解析后是setting.php本身处理,有点奇怪啊,代码里没有进行相关处理的啊。我技术一点都不懂,请大家指教一下,这里的action究竟是在哪里
0
See Also
Nearby
- 上一篇 › QQ登陆get_openid失败是怎么回事?
- 下一篇 › 帖子页面的布局,发长段落看起来比较难受
#2 只是定位到设置头像的地方,
form 里面有个
<input type="hidden" name="action" value="avatar" />
是给后台处理的标识。
@admin 还是没说清楚,保存图片是谁在工作?我的情况是不允许上传,只提供一些选择,这样只要保存头像id就行了,其他写文件的也不用操作
@admin 找到了,我开始是编辑模板中的setting.php,处理的代码在根目录
@oblol 看来把模板文件以php为后缀名是个错误,虽然在文件夹templates 下。
@admin 我修改了根目录的setting.php,现在出错了No such file or directory in /home/wwwroot/bbs.oblol.com/templates/default/setting.php on line 4
找不到模板,但引入这个文件也是在最后啊
要抓狂了,两个文件混淆了,改错地方了
setting.php
else if($action == 'avatar'){ $avatar = intval($_POST['avatar']); if($avatar){ if($DBS->unbuffered_query("UPDATE youbbs_users SET avatar='$avatar' WHERE id='$cur_uid'")){ //更新缓存 $cur_user['avatar'] = $avatar; $tip1 = '已更新头像'; }else{ $tip1 = '数据库更新失败,修改尚未保存,请稍后再试'; } }else{ $tip1 = '请选择头像'; } }
楼上$tip1应更正为$tip2
/templates/default/setting.php
<div class="main-box"> <p class="red">',$tip2,'</p> <form action="',$_SERVER["REQUEST_URI"],'#2" enctype="multipart/form-data" method="post"> <input type="hidden" name="action" value="avatar" /> <input type="hidden" name="MAX_FILE_SIZE" value="300000" /> <table cellpadding="5" cellspacing="8" border="0" width="100%" class="fs12"> <tbody><tr> <td width="120" align="right">当前头像</td> <td width="auto" align="left"> '; for($i=1;$i<=30;$i++){ //上面的30是头像数量 echo '<input type="radio" name="avatar" value = "',$i,'"><img src="/avatar/large/',$i,'.png?',$av_time,'" class="avatar" border="0" align="default" auto=""> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; '; } echo ' </td> </tr> <tr> <td width="120" align="right"></td> <td width="auto" align="left"><input type="submit" value="更新头像" name="submit" class="textbtn" /></td> </tr> </tbody></table> </form> </div>';
ok了,大家可以去观赏一下我写的渣js
http://bbs.oblol.com