php header('Content-Type: text/html; charset=utf-8');

php header('Content-Type: text/html; charset=utf-8');

 header的用法 header()函数的作用是:发送一个原始 HTTP 标头[Http Header]到客户端。标头 (header) 是服务器以 HTTP 协义传 HTML 资料到浏览器前所送出的字串,在标头 与 HTML 文件之间尚需空一行分隔。有关 HTTP 的详细说明,可以参 RFC 2068 官方文件 (http://www.w3.org/Protocols/rfc2068/r...

PHP 2019-12-14 AM 3751次 0条
php 分页、全选、反选、全不选、批量删除

php 分页、全选、反选、全不选、批量删除

<?php/**用户管理2011/8/22kcj*/include "isLogin.php";include "../conn/conn.php";$sql="select * from user";$rst=mysql_query($sql);$totalnum=mysql_num_rows($rst);$pagesize=5;$page=$_GET['page'];if($pag...

PHP 2019-12-14 AM 2728次 0条
PHP去掉指定的html标签

PHP去掉指定的html标签

function _strip_tags($tags_a,$str){ foreach ($tags_a as $tag) { $p[]="/(<(?:\/".$tag."|".$tag.")[^>]*>)/i"; } $return_str = preg_replace($p,"",$str); re...

PHP 2019-12-14 AM 3193次 0条
php截取指定字符串之间的字符串的类

php截取指定字符串之间的字符串的类

<?phpclass get_c_str {var $str;var $start_str;var $end_str;var $start_pos;var $end_pos;var $c_str_l;var $contents;function get_str($str,$start_str,$end_str){ $this->str = $str; $this->...

PHP 2019-12-14 AM 2392次 0条
php 根据IP获取城市名称

php 根据IP获取城市名称

//获取省份function getArea($ip){$ip = getIp(); $res1 = file_get_contents("http://pv.sohu.com/cityjson?ie=utf-8"); $str = cut('cname','};',$res1); $str = str_replace('"',"",$str...

PHP 2019-12-12 PM 3419次 0条
php 获得数组中重复的数据

php 获得数组中重复的数据

function fetchRepeatMemberInArray($array){// 获取去掉重复数据的数组 $unique_arr = array_unique($array); // 获取重复数据的数组 $repeat_arr = array_diff_assoc($array, $unique_arr); return $repeat_arr;}

PHP 2019-12-11 PM 2987次 0条
php 求两个已知经纬度之间的距离,单位为米

php 求两个已知经纬度之间的距离,单位为米

/** *求两个已知经纬度之间的距离,单位为米 *@param lng1,lng2 经度 *@param lat1,lat2 纬度 *@return float 距离,单位米 **/function getdistance($lng1,$lat1,$lng2,$lat2){//将角度转为狐度 $radLat1=deg2rad($lat1);//deg2rad()函数将角度转换为弧度 $rad...

PHP 2019-12-11 PM 2493次 0条
php  对数据进行编码转换

php 对数据进行编码转换

/**对数据进行编码转换@param array/string $data 数组@param string $output 转换后的编码Created on 2016-7-13 */function array_iconv($data,$output = 'utf-8') {$encode_arr = array('UTF-8','ASCII','GBK','GB2312','BIG5','...

PHP 2019-12-11 PM 3314次 0条
php 将UNICODE编码后的内容进行解码

php 将UNICODE编码后的内容进行解码

function unicode_decode($name){// 转换编码,将Unicode编码转换成可以浏览的utf-8编码 $pattern = '/([\w]+)|(\\\u([\w]{4}))/i'; preg_match_all($pattern, $name, $matches); if (!empty($matches)) { $name = ''; for ...

PHP 2019-12-11 PM 2508次 0条
php 遍历文件夹下的所有文件

php 遍历文件夹下的所有文件

/**$data 文件夹路径**/function list_file($date){ $fileArr = []; //1、首先先读取文件夹 $temp=scandir($date); //遍历文件夹 foreach($temp as $v){ $a=$date.'/'.$v; if(is_dir($a)){//如果是文件夹则执行 if($v=='.' || $v=...

PHP 2019-12-11 PM 3416次 0条
php验证邮箱格式

php验证邮箱格式

/**验证邮箱格式@param $email 邮箱@return bool */function is_email($email) {$chars = "/^[0-9a-zA-Z]+(?:[\_\.\-][a-z0-9\-]+)*@[a-zA-Z0-9]+(?:[-.][a-zA-Z0-9]+)*\.[a-zA-Z]+$/i"; if (preg_match($chars...

PHP 2019-12-11 PM 2508次 0条