This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function DeleteHtml($str) //清除字符串的空格 | |
{ | |
$str = trim($str); | |
$str = preg_replace("/\t/","",$str); | |
$str = preg_replace("/\r\n/","",$str); | |
$str = preg_replace("/\r/","",$str); | |
$str = preg_replace("/\n/","",$str); | |
$str = preg_replace("/ /","",$str); | |
$str = preg_replace("/ /","",$str); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function saveImage($path) { | |
if(!preg_match('/\/([^\/]+\.[a-z]{3,4})$/i',$path,$matches)) //匹配图片 | |
die('Use image please'); | |
$image_name = strToLower($matches[1]); | |
$ch = curl_init ($path); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1); | |
$img = curl_exec ($ch); | |
curl_close ($ch); |