html5_手机web开发
来源:互联网 发布:ps软件快捷键大全 编辑:程序博客网 时间:2024/05/21 14:53
手机屏幕上的网页宽度适配
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1, user-scalable=0, minimal-ui"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=2.0, user-scalable=yes" /> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="format-detection" content="telephone=no" />
页面反馈及效果
<!DOCTYPE html><html><head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=2.0, user-scalable=yes" /> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="format-detection" content="telephone=no" /> <style type="text/css">div{ margin-left:1px;}#submit{margin-left:2px;}</style><script type="text/javascript">var isCommited = false;function isNull( str ){if ( str == "" ) return true;var regu = "^[ ]+$";var re = new RegExp(regu);return re.test(str);}function validate_required(field,alerttxt){with (field) { if (value==null||value==""||isNull(value)) {alert(alerttxt);return false} else { if(!isCommited){isCommited = true;return true;}else{alert('请勿重复提交');return false;} } }}function validate_form(thisform){with (thisform) { if (validate_required(content,"文物名称为必填项")==false) {content.focus();return false} }}</script><head><body><form action="http://sg31.com/ci/feedback/insert" method="post" onsubmit="return validate_form(this)" ><input name="language" type="hidden" value="guobao"><div id="big_1" style="clear:both;"><div id="a" style="float:left; height:32px;width:32px"><img src="guobao_title.png" alt="" width = "32px" height = "32px"/></div><div id="b" style="float:left; height:32px;width:50%"><input type="text" name="content" value="" placeholder="请输入要纠错的文物名称" style="width:100%;height:32px;" /></div><div style="clear:both"></div><!--这个层很有用,必须要,否则可能不兼容。--> </div><div id="big_2" style="clear:both;height=10px;"> <br/> </div><div id="c" style="clear:both;"><div id="a" style="float:left; height:32px;width:32px"><img src="guobao_phone.png" alt="" width = "32px" height = "32px"/></div><div id="b" style="float:left; height:32px;width:50%"><input type="text" name="contact" value="" placeholder="请留下妳的联系方式(可空)" style="width:100%;height:32px;" /></div><div style="clear:both"></div><!--这个层很有用,必须要,否则可能不兼容。--> </div><div id="d" style="clear:both;height=10px;"> <br/> </div><input id="submit_btn" name="submit" type="image" src="guobao_submit.png" alt="Submit" width="32px" height="32px"></form> </body></html>
除js防重复提交外,数据库多列唯一索引防重复提交(ip,content,date)
ALTER TABLE sg_app_feedback ADD CONSTRAINT uc_contentipaddresspubdate UNIQUE (content,ipaddress,pubdate)ALTER TABLE sg_app_feedback DROP INDEX uc_contentipaddresspubdatedate("Y-m-d")
使用ci框架的php代码
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');header("Content-Type: text/html; charset=utf-8");class Feedback extends CI_Controller { // 录入到where表格中,并且返回另一半的地址 public function insert(){ $language = $_POST["language"]; $content = $_POST["content"]; // 可空 $contact = $_POST["contact"]; $ipaddress = $_SERVER["REMOTE_ADDR"]; $servername = $_SERVER['SERVER_NAME']; if ($servername != "sg31.com") { # code... echo "非法的访问"; return; } // 时间戳 $timeStamp = time(); if (strlen($content) > 250 || strlen($contact) > 250 || strlen($language) > 250) { # code... echo "字数不得超过255"; return; } if (strlen($content) == 0 || strlen($language) == 0) { # code... echo "妳还没有输入内容"; return; } if (strlen($contact) == 0) { # code... $contact = "sg31.com"; } // 成功则插入,返回ok // 插入 (REMOTE_ADDR) // 时间戳 $pubtime = time(); $pubdate = date("Y-m-d"); $sql = 'INSERT INTO sg_app_feedback(language,content,contact,pubtime,ipaddress,pubdate) VALUES(?,?,?,?,?,?)'; // $sql = "SELECT * FROM some_table WHERE id = ? AND status = ? AND author = ?"; $B = $this->db->query($sql, array($language,$content,$contact,$pubtime,$ipaddress,$pubdate)); if ($B == 1) { # code... // 插入成功,返回ok echo "<h1>ok</h1>"; } } }/* End of file log.php *//* Location: ./application/controllers/log.php */
0 0
- html5_手机web开发
- 手机web开发资料
- 手机web开发资料
- 手机web开发笔记
- 手机web 开发
- Web手机开发框架一览
- 手机Web开发框架集
- 移动web手机开发--定位
- 手机开发web?native?hybrid?
- Java 手机Web开发 身份验证
- 【Web前端学习笔记】HTML5_基础,基本标记
- 手机web app开发实现刮刮卡
- Html5 Web App 手机跨平台开发
- 手机web网站前端开发布局技巧
- Viewport在开发手机Web中的应用
- 使用ADF Mobile开发手机Web应用
- 手机端网页web开发要点
- 手机端网页web开发要点
- 布局转换
- react-native(1)------mac安装、配置、使用
- CALayerAnimations
- JS运动框架-move3.js
- 条件: 应用 T681A
- html5_手机web开发
- Java多线程一
- iOS相机相册使用权限
- 上下滑动的侧边栏
- 第十五周之字符串处理
- 任意值运动框架
- 知识库--The Pipeline Interface
- iOS截取图片的一部分
- 保持简单:Uber流处理架构演进的四字箴言 | 附124页PPT下载