php curl模拟get/post提交

php curl模拟get/post提交

/** * curl模拟get/post提交 * @param $url 请求的url地址 * @param $data 发送的数据 * @param $type 请求的类型 * @return $result 返回的数据 */ function httpsRequest(String $url, $data = [], $type = "html"){ $curl = curl_init(); // 启动一个CURL会话 curl_setopt($curl, CURLOPT_URL, $url); // 要访问的地址 curl_se...

PHP 2019-12-11 PM 1770℃ 0条
php中文转阿拉伯

php中文转阿拉伯

/**中文转阿拉伯@param $str@return float|int|mixed */function chrtonum($str){$num = 0; $bins = array("零", "一", "二", "三", "四", "五", "六", "七", "八", "九", 'a' => "个", 'b' => "十", 'c'...

PHP 2019-12-11 PM 1751℃ 0条
php curl模拟get请求

php curl模拟get请求

/*** @param string $url 地址 */function get_url($url){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); //设置访问的url地址 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);//不输出内容 ...

PHP 2019-12-11 PM 1807℃ 0条
php随机IP

php随机IP

/**随机IP方法@param@return string $huoduan_ip 最终IP地址 */function rand_ip(){$ip_long = array( array('607649792', '608174079'), //36.56.0.0-36.63.255.255 array('975044608', '977272831'), //58.30.0.0-58.63.255.255 array('999751680', '999784447'), //59.151.0.0-59.151.127.255 ...

PHP 2019-12-11 PM 2729℃ 0条
php手机号

php手机号

//随机手机号function randphone(){$arr = array(130,131,132,133,134,135,136,137,138,139, 144,147, 150,151,152,153,155,156,157,158,159, 176,177,178, 180,181,182,183,184,185,186,187,188,189, ); return $arr[mt_rand(0, (count($arr)-1))].mt_rand(1000, 9999).mt_rand(1000, 9999);}

PHP 2019-12-11 PM 1794℃ 0条
PHP实现的敏感词过滤方法

PHP实现的敏感词过滤方法

<?php/*PHP实现的敏感词过滤方法*//**@todo 敏感词过滤,返回结果@param array $list 定义敏感词一维数组@param string $string 要过滤的内容@return string $log 处理结果 */function sensitive($list, $string){$count = 0; //违规词的个数 $sensitiveWord = ''; //违规词 $stringAfter = $string; //替换后的内容 $pattern = "/".implode("|",$lis...

PHP 2019-12-11 PM 3160℃ 0条
php根据出生日期计算 年龄/生肖/星座

php根据出生日期计算 年龄/生肖/星座

/**根据出生日期计算 年龄/生肖/星座@param $birth 日期格式的年月日,例:'1999-11-15'@param $symbol 用什么符号分割,例:'-'@return $data 返回数据 */function birthday($birth, $symbol='-'){// 把数组中的值赋给变量 list($birth_year, $birth_month, $birth_day) = explode($symbol, $birth); // 计算年龄 $now_month = date('n'); // 当前月份,不带前导0 $now_day = date('j')...

PHP 2019-12-11 PM 2086℃ 0条
php获取最近七天所有日期

php获取最近七天所有日期

/**获取最近七天所有日期@param string $time@param string $format@return array*/ function get_weeks($time = '', $format='Y-m-d'){ $time = $time != '' ? $time : time(); //组合数据 $date = []; for ($i=1; $i<=7; $i++){ $date[$i] = date($format ,strtotime( '+' . $i-7 .' days', $time)); } return...

PHP 2019-12-11 PM 1959℃ 0条
PHP常见header状态

PHP常见header状态

<?php//200 正常状态 header('HTTP/1.1 200 OK'); // 301 永久重定向,记得在后面要加重定向地址 Location:$url header('HTTP/1.1 301 Moved Permanently'); // 重定向,其实就是302 暂时重定向 header('Location: http://www.maiyoule.com/'); // 设置页面304 没有修改 header('HTTP/1.1 304 Not Modified'); // 显示登录框, header('HTTP/1.1 401 ...

PHP 2019-12-11 PM 2642℃ 0条
php下载图片

php下载图片

public function down_images() {//下载图片的链接$url = 'http://qr.liantu.com/api.php?text=https://www.girlsf.com/frontend/public/index.php/subject/personal/index'; $header = array("Connection: Keep-Alive", "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", &...

PHP 2019-12-11 PM 1790℃ 0条
php友好的时间显示

php友好的时间显示

/**友好的时间显示 *@author yhm *@param int $sTime 待显示的时间@param string $type 类型. normal | mohu | full | ymd | other@param string $alt 已失效 *@return string */function friendly_date($sTime, $type = 'normal', $alt = 'false'){if (!$sTime) return ''; //sTime=源时间,cTime=当前时间,dTime=时间差 $cTime = time(); $dTime = $...

PHP 2019-12-11 PM 2614℃ 0条