-
10个对初学者非常有用的PHP攻略
[PHP教程] 2022-06-23 13:31:46 138人阅读
本文介绍一些关于改善和优化PHP代码的提示和技巧,供大家参考,具体内容如下 1.不要使用相对路径,要定义一个根路径 这样的代码行很常见: require_once(../../lib/some_class.php); 这种方法有很多缺点: 1)、它首...[详细]
-
PHP安全下载文件的方法介绍
[PHP教程] 2022-06-23 13:31:18 78人阅读
本文实例讲述了PHP安全下载文件的方法。分享给大家供大家参考,具体如下: ?php header(Content-Type:text/html;Charset=utf-8); define(ROOT_PATH, dirname(__FILE__)); /** * 下载文件 * @param string $file_path...[详细]
-
PHP实现基于mysqli的Model基类完整例子
[PHP教程] 2022-06-23 13:30:46 93人阅读
本文实例讲述了PHP实现基于mysqli的Model基类。分享给大家供大家参考,具体如下: DB.class.php ?php //数据库连接类 class DB { //获取对象句柄 static public function getDB() { $_mysqli = new mysqli(DB_HOST,D...[详细]
-
PHP实现的DES加密解密案例代码
[PHP教程] 2022-06-23 13:30:20 113人阅读
本文实例讲述了PHP实现的DES加密解密实例。分享给大家供大家参考,具体如下: ?php $key = very important data; function jiami($key, $str) { /* Open module, and create IV */ $td = mcrypt_module_open(des, , ...[详细]
-
php运用正则验证中文
[PHP教程] 2022-06-23 13:29:52 71人阅读
php用preg_match来匹配并判断一个字符串中是否含有中文或者都是中文的方法如下: $str = php学习博客; if(preg_match(/[\x7f-\xff]/, $str)){ echo 字符串中有中文br; }else{ echo 字符串中没有中文br; } if(preg_ma...[详细]
-
在PHP中file_exists使用中遇到的问题小结
[PHP教程] 2022-06-23 13:29:33 97人阅读
我发现了一个问题,今天与大家分享。我把整个过程描述一下。 问题:公司有个框架是基于smarty写的,我负责php的升级,维护人员把新环境布上来之后,测试人员找我提出经常报错(错误:提示找不到文件的)。 我追踪了一...[详细]
-
php通过curl添加cookie伪造登陆抓取数据的方法
[PHP教程] 2022-06-23 13:29:01 198人阅读
本文实例讲述了php通过curl添加cookie伪造登陆抓取数据的方法。分享给大家供大家参考,具体如下: 有的网页必须登陆才能看到,这个时候想要抓取信息必须在header里面传递cookie值才能获取 1、首先登陆网站,打开fire...[详细]
-
PHP读取大文件的多种方法分享
[PHP教程] 2022-06-23 13:28:33 60人阅读
读取大文件一直是一个头痛的问题,我们像使用php开发读取小文件可以直接使用各种函数实现,但一到大文章就会发现常用的方法是无法正常使用或时间太长太卡了,下面我们就一起来看看关于php读取大文件问题解决办法,希...[详细]
-
使用 PHPStan 增强PHP代码质量
[PHP教程] 2022-06-23 13:27:26 54人阅读
这里介绍一款PHP代码静态分析工具:PHPStan,不需要运行代码,也可以对代码进行严格的语法检测,尽量将代码运行错误率降到最低。 PHPStan 安装 目前,PHPStanV0.10.2要求系统环境的PHP版本不低于7.1。用Composer全局...[详细]
-
在php 中运用PDO MySQL的扩展
[PHP教程] 2022-06-23 13:26:56 60人阅读
PHP下开启PDO MySQL的扩展 PDO扩展为PHP访问数据zd库定义了一个轻量级的、一致性的接口,它提供了一个数据访问抽象层,这样,无论使用什么数据库,都可以通过一致的函数版执行查询和获取数据。 开启PDO和PDO_MySQL扩...[详细]
- 这篇文章主要介绍了Laravel 5.0 发布 新版本特性详解,...[详细]
- 计算两个日期之间的时间差需要先把两个日期转换成纪元...[详细]
- 初步使用面向对象程序设计,要掌握的就是使用面向对象...[详细]
- 每个 PHP 数组内部都有一个指针,该指针指向数组的某...[详细]
- 因为 PHP 是一个 Web 编程语言,在编程过程中难免会遇...[详细]
- PHP 中提供了 return 语句来返回函数的运行结果,其语...[详细]
- final 关键字的作用如下: 使用 final 修饰的类,不能...[详细]
- 在使用 switch 语句时应该注意以下几点: 和 if 语句...[详细]
- 这篇文章主要给大家介绍了关于PHP替换Word中变量并导...[详细]
- 这篇文章主要介绍了PHP常量DIRECTORY_SEPARATOR原理及...[详细]