为了能够更好的提升系统的安全性,把原来的进销存系统源码升级,遇到了一些问题在这儿总结一下:

1.mysql引擎在php7中不在支持会导致以下错误

Uncaught Error: Call to a member function init() on null 。

其实在init()函数中,有extension_loaded("mysql"),即加载mysql扩展导致的,需要改为mysqli,不过后面的mysql操作函数都需要改成mysqli的对应类型。

2.Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP;

Smarty has a deprecated constructor in /www/platform/library/Platform/View/Smarty/Smarty.class.php
[引自原文]:https://blog.csdn.net/sanbingyutuoniao123/article/details/78614077

原来是smarty模板类还是使用了php4的构造函数的写法,所以找到smarty类后,找到与类同名的函数,将函数名改

为__construct即可。

PHP OOP使用和类名相同的方法名作为构造方法,是 PHP4 的写法,PHP 5中同时支持__construct和类同名方法,但__construct方法具有优先性。

PHP 7开始使用和类名相同的方法名作为构造方法会报E_DEPRECATED级别的错误,提示在未来版本中会彻底抛弃类同名方法作为

构造函数。但程序仍然会正常执行。

<?php
class a{
function a(){ // 此处改为 function __construct() }
}
?>

3.Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP)

在php7中,MYSQL_ASSOC不再是一个常量,将 MYSQL_ASSOC改为MYSQLI_ASSOC,意思是mysqli的方式提取数组,而不再是mysql 。(原因:mysql_fetch_arrayhan函数转为mysqli_fetch_array,参数没有修改)

4.汉字显示为???(问号) 的解决办法

mysqli_query($conn,'set names utf8');在使用mysqli_query()查询数据的时候,最好指定字符的编码

最新文章

  1. ARP协议学习
  2. gradle使用
  3. 写css时要注意数字的浮动方向
  4. 可在广域网部署运行的QQ高仿版 -- GG叽叽(源码)
  5. Angular JS | Closure | Google Web Toolkit | Dart | Polymer 概要汇集
  6. IOS开发之开发者账号遇到的bug
  7. sudo: /etc/sudoers is mode 0777, should be 0440终极解决之道
  8. 恶意IP远程登录Linux服务器脚本
  9. Your content must have a ListView whose id attribute is &#39;android.R.id.list&#39;
  10. Backbone.js学习之初识hello-world
  11. 桶排序之python实现源码
  12. 几种画直线的方法-孙鑫C++笔记
  13. Delphi获取当前系统时间(使用API函数GetSystemTime)
  14. priority_queue 优先队列
  15. .net 框架
  16. Access数据库自动生成设计文档
  17. BZOJ 3674 可持久化并查集
  18. jmeter手写脚本,使用正则获取cookie(禁用cookies管理器)
  19. update条件判断更新
  20. C++类有继承时,析构函数必须为虚函数

热门文章

  1. 【数论】nefu119 组合素数
  2. [转]spring4.x注解概述
  3. enum don&#39;t allocate any memory
  4. linux下的udev是干嘛的,能否说的通俗点
  5. String.format(&quot;%0&quot;+length+&quot;d&quot;, arr)中的%0和&quot;d&quot;分别代表什么
  6. 【mybatis】分别按照 天 月 年 统计查询
  7. Cisco路由技术基础知识详解
  8. API Monitor---------------Using API Monitor to crack copy protected software
  9. 如何查看Oracle日志
  10. STL容器简介