-
PHP自动识别字符集编码并达成转码
[PHP教程] 2022-01-21 14:21:15 118人阅读
原理很简单,因为gb2312/gbk是中文两字节,这两个字节是有取值范围的,而utf-8中汉字是三字节,同样每个字节也有取值范围,而英文不管在何种编码情况下,都是小于128,只占用一个字节,全角除外. 在PHP处理页面的时候,我们对...[详细]
-
PHP 去除 utf8格式文件中的bom头部
[PHP教程] 2022-01-21 14:20:53 173人阅读
我们有时要去掉utf8文档中头部我们经常会需要手工清除了,下面我整理了几个利用php程序清除 utf8格式文件中的bom头部方法. PHP实例1,代码如下: /** * 去掉文件中的 bom头 * @var 0.1 * @author Chenwp */ function cl...[详细]
-
PHP运用curl获取验证码,发送cookie二次抓取
[PHP教程] 2022-01-21 14:20:34 108人阅读
?php $CookieFile=tempnam(./tmep,beast); if(isset($_GET[img])){ $url = http://www.Cuoxin.com/phper/php.htm;//验证码code $ch = curl_init($url); curl_setopt($ch,CURLOPT_COOKIEJAR, $CookieFile);//把返回来...[详细]
-
PHP中的cURL请求及示例学习笔记
[PHP教程] 2022-01-21 14:20:08 53人阅读
cURL是php中一个很强大的功能,可以模仿各种用户请求,如模仿用户登录,发送php cookie等等操作,使用curl_init函数,必须要打开这个php扩展. 1.打开php.ini,开启extension=php_curl.dll 2.检查php.ini的extension_dir值...[详细]
-
PHP网址缩短代码 生成短网址
[PHP教程] 2022-01-21 14:19:34 102人阅读
每个网址用6个字符代替,(32^6) 最多可以拥有1,073,741,824个短网址,当然,你还可以记录更详细的信息,如访问记录,创建时间等,如果真不够用了,还可以删掉很久不用的,代码如下: function shorturl($input) { $base32 = ...[详细]
-
php 判断访问者是否手机客户端实例
[PHP教程] 2022-01-21 14:18:31 189人阅读
最近移动互联网火爆了我们需要做一个PC站与WAP站,要实现如果用户是电脑访问WAP站就自动进入PC站,反之一样,下面我整理了一些代码与大家一起来看看. 方法一,判断HTTP_USER_AGENT,代码如下: $agent = strtolower($_SERV...[详细]
-
php完成input输入框失去焦点自动保存输入框的数
[PHP教程] 2022-01-21 14:16:35 60人阅读
最近做一个输入框失去焦点时自动保存数据的功能,当然就是jQuery选择器选择input,blur时,ajax提交数据给php文件,php文件保存一下数据,主要是要注意一下中文的问题,所以中间需要转一下编码. 下面的实例是一个列表页,有...[详细]
-
php生成与读取excel文件 .csv 实例
[PHP教程] 2022-01-21 14:14:32 155人阅读
这里我们是介绍利用php的fgetcsv函数直接来读取.csv文件了,并不是真正的excel文件,如果要读取真正的excel文件我们需要使用插件了,下面我会简单介绍一下. excel文件(.csv),代码如下: ?php function getCSVdata($filen...[详细]
-
PHP批量下载html和css中图片文件示例
[PHP教程] 2022-01-21 14:14:00 62人阅读
最近一直很忙,遇到一个手工活,需要下载一些远程的图片,一共一百多张,如果通过手工一张一张的保存,也太耗费时间了,于是上网google了一把,找到PHP批量下载图片文件的方法,原文是出自平凡世界博客的一片关于如何使用PHP...[详细]
-
php判断ip黑名单程序代码
[PHP教程] 2022-01-21 14:13:33 159人阅读
学校的新闻系统要求有些新闻只开放校内ip浏览,于是重写了一个代码来实现此功能,实现后的结果是,只要把允许访问的ip列入ip.txt这个文件中即可,同时支持c类ip,例如: ip.txt 192.168 211.67.188 211.67.191.25 PHP实例...[详细]
- 这篇文章主要介绍了Laravel 5.0 发布 新版本特性详解,...[详细]
- 计算两个日期之间的时间差需要先把两个日期转换成纪元...[详细]
- 初步使用面向对象程序设计,要掌握的就是使用面向对象...[详细]
- 每个 PHP 数组内部都有一个指针,该指针指向数组的某...[详细]
- 因为 PHP 是一个 Web 编程语言,在编程过程中难免会遇...[详细]
- PHP 中提供了 return 语句来返回函数的运行结果,其语...[详细]
- final 关键字的作用如下: 使用 final 修饰的类,不能...[详细]
- 在使用 switch 语句时应该注意以下几点: 和 if 语句...[详细]
- 这篇文章主要给大家介绍了关于PHP替换Word中变量并导...[详细]
- 这篇文章主要介绍了PHP常量DIRECTORY_SEPARATOR原理及...[详细]