php7 兼容 MySQL 相关函数
php7 兼容 MySQL 相关函数
PHP7 废除了 ”mysql.dll” ,推荐使用 mysqli 或者 pdo_mysql
http://PHP.net/manual/zh/mysqlinfo.api.choosing.php
http://blog.csdn.NET/beimuaihui/article/details/50235907
《Discuz X3.2 对 PHP7 的兼容性处理 》 https://branchzero.com/tech/discuz-x32-php7.html
// *************** PHP7 START ***************
if(!function_exists('mysql_pconnect')){
$mysqli = mysqli_connect("$dbhost:$dbport", $dbuser, $dbpass, $dbname);
function mysql_pconnect($dbhost, $dbuser, $dbpass){
global $dbport;
global $dbname;
global $mysqli;
$mysqli = mysqli_connect("$dbhost:$dbport", $dbuser, $dbpass, $dbname);
return $mysqli;
}
function mysql_select_db($dbname){
global $mysqli;
return mysqli_select_db($mysqli,$dbname);
}
function mysql_fetch_array($result){
return mysqli_fetch_array($result);
}
function mysql_fetch_assoc($result){
return mysqli_fetch_assoc($result);
}
function mysql_fetch_row($result){
return mysqli_fetch_row($result);
}
function mysql_query($query){
global $mysqli;
return mysqli_query($mysqli,$query);
}
function mysql_escape_string($data){
global $mysqli;
return mysqli_real_escape_string($mysqli, $data);
//return addslashes(trim($data));
}
function mysql_real_escape_string($data){
return mysql_real_escape_string($data);
}
function mysql_close(){
global $mysqli;
return mysqli_close($mysqli);
}
}
php7 兼容 MySQL 相关函数的更多相关文章
- PHP7兼容mysql_connect的方法
在php7版本的时候,mysql_connect已经不再被支持了,本文将讲述在代码层面实现php7兼容mysql系列,mysql_connect等操作. PHP7不再兼容mysql系列函数,入mysq ...
- php7连接mysql测试代码
php7连接mysql测试代码 <?php $mysqli = new mysqli("localhost", "root", "passwor ...
- Web项目--------原Oracle数据库的项目同时兼容MySql
原Oracle数据库的项目同时兼容MySql步骤: (一)修改资源配置文件applicationContext-dataSource.xml的数据库连接 Oracle数据库中加上from dual的原 ...
- Aurora: 来自 Amazon 的高性能的企业级关系数据库,兼容 MySQL
近日,在美国召开的AWS re:Invent云计算大会上,Amazon高级副总裁安迪·杰西发布了企业级关系数据库Aurora.Aurora是一个面向Amazon RDS(关系数据库服务).兼容MySQ ...
- CentOS安装PHP7+Nginx+MySQL
本文属于动手搭建PHP开发环境的一部分,更多点击链接查看. 本文以centos6为例.命令部分均省略sudo命令. 安装PHP 下载 http://cn2.php.net/distributions/ ...
- Ubunt16.04下安装PHP7+Nginx+MySQL
本文通过Ubuntu PPA来安装PHP7. 1.添加PPA $ sudo apt-get install python-software-properties software-properti ...
- 教你编译PHP7 (nginx+mysql+php7)
# 安装编译工具: yum install gcc automake autoconf libtool gcc-c++ # 安装基础库 yum install gd zlib zlib-devel o ...
- ubuntu16.4安装php7+apache2+mysql环境全过程记录
1.安装apache2 sudo apt-get install apache2 2.安装php7 sudo apt-get install php7.0 3.apache 识别php插件(不是必须, ...
- Mac下使用brew搭建PHP7+nginx+mysql开发环境
http://blog.csdn.net/mysteryhaohao/article/details/52230634 HomeBrew brew的安装,直接上官网:http://brew.sh/ 一 ...
随机推荐
- 用typename和template消除歧义
- openGl超级宝典学习笔记 (2) 7个主要的几何图元
点(GL_POINTS): 点总是正方形的像素,默认情况下,点的大小不受透视除法影响. 即无论与视点的距离怎样,它的大小都不改变.为了获得圆点.必须在抗锯齿模式下绘制点. 能够用glPointSize ...
- [LeetCode]Single Number 异或的妙用
1.数组中仅仅有一个元素仅仅出现一次,其余出现偶数次. 利用异或中同样元素相互抵消的方式求解. 2.数组中仅仅有2个元素仅仅出现一次.其余出现偶数次. class Solution { public: ...
- OC07 -- 迭代器/NSNumber/NSValue/NSRange/NSSet/NSDate 及相互转换.(杂)
//一: 迭代器 //数组 NSArray *arr=@[@"1",@"2",@"3",@"4",@"5&qu ...
- Protocol Buffers的基础说明和使用
我们開始须要使用protobuf的原因是,在处理OJ的contest模块的时候,碰到一个问题就是生成contestRank的时候.须要存储非常多信息. 假设我们採用model存储的话,那么一方面兴许假 ...
- Git的日常处理流程
前提 本地有2个分支,一个是master,还有一个是local master 默认追踪origin/master local 通过git branch -u origin/master来映射 开发的时 ...
- Python3小白初体验
三层循环嵌套,以后优化 data = { "北京":{ "a":{ ", " }, "b":{ ", &quo ...
- 暑假集训-WHUST 2015 Summer Contest #0.2
ID Origin Title 10 / 55 Problem A Gym 100625A Administrative Difficulties 4 / 6 Problem B Gym 1006 ...
- 关于viewport详解
- Codefroces 852 G. Bathroom terminal
G. Bathroom terminal Smith wakes up at the side of a dirty, disused bathroom, his ankle chained to p ...