JQuery学习(4-2-php服务器端1)
来源:互联网 发布:log4j2 打印sql 编辑:程序博客网 时间:2024/05/01 22:46
主要内容:介绍图片的上传过程,涉及PHP跟JQuery;
1. 读取配置文件,连接MySQL数据库;
配置文件主要有用户名和密码;
3-5.php
<?php/** version : 20141108*//** 定义一个常量*/define("EQUAL","=");define("SPACE","");function get_content($file){if(!file_exists($file)) return false; return file_get_contents($file);}function get_config($str, $ini, $type="string"){ if ($type=="int"){ $config = preg_match("/".preg_quote($ini)."=(.*);/", $str, $res); if($config==0) return false;} else{ $config = preg_match("/".preg_quote($ini)."=\"(.*)\";/", $str, $res); if($config==0) return false;} $result=explode(EQUAL,$res[0]);return preg_replace("/(\"|\'|;)/",SPACE,$result[1]);} ?>
2. 连接MySQL数据库;
这里使用PHP提供的odbc类;
首先安装数据源驱动,类如mysql-connector-odbc-5.3.4-win32;然后在ODBC数据源管理其中配置就OK了。
2.1 写数据库的连接操作
<?php/** version : 20141109* made dy : neojos*/include_once("3-5.php");class dbSource{function __construct(){$dbString=get_content("config.ini");$server=get_config($dbString,"server");echo $dbname=get_config($dbString,"userName");echo $dbpwd=get_config($dbString,"password");odbc_connect("DRIVER={MySQL ODBC 5.3 ANSI Driver};",$dbname,$dbpwd) or handle_error("",odbc_error()); }function handle_error($user_error_message,$system_error_message){header("Location:3-6.php?"."error_message={$user_error_message}&"."system_error={$system_error_message}");exit();}}$db=new dbSource();?>
0 1
- JQuery学习(4-2-php服务器端1)
- php之jquery学习
- Jquery.Ajax+php 学习笔记
- Jquery.Ajax+php 学习笔记
- JQuery学习(4-1)
- [php学习十七]JQuery练习2-动画
- [php学习十六]JQuery练习1-选择器
- jquery+json+php新手实践<客户端传值_服务器端计算>
- jQuery从服务器获取数据使用post(字典查询的功能),服务器端php返回数据
- 基于jQuery的ajax跨域请求,PHP作为服务器端代码
- PHP服务器端手机号码验证
- PHP Push 服务器端代码
- 百度PUSH PHP服务器端
- PHP服务器端的思想
- Java 服务器端学习1------聊天程序
- Jquery学习4-1---jquery用法之访问jquery对象
- PHP程序与服务器端通讯方法小结(1)
- [原创][技术]PHP学习笔记(4)--PHP高级1/2
- 1.DNA序列
- IOS7的状态栏和导航栏
- yeelink HTTP格式学习
- PJSIP开发手册之解析器(四)
- HTML5定稿了,原生App世界将被颠覆???
- JQuery学习(4-2-php服务器端1)
- cannot find crt1.o No such file or directory的一种解决方法
- ruby on rails的一些安装注意事项
- Unicode下的CString与String之间的相互转换
- linux动态库版本号管理
- 排序算法——归并排序
- 互联网广告系统综述七特征
- BiTree建立,先序,中序,后序递归、非递归遍历
- 大学生活的一点思索