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
/** | |
*$url = 'http://wx.qlogo.cn/mmopen/xu0fLo9waqKSTDO7j0kSO41O5Luq3LB6ozUvY4O7OsXUWNicB49fBs8nGYzoqcwGDARQZHpVuic4JSDngEVjVo10BoiaPd0iciaOb/0'; | |
*$a = curl_file_get_contents($url); | |
*file_put_contents('uploads/2.jpg', $a); | |
*/ | |
function curl_file_get_contents($durl){ | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $durl); | |
curl_setopt($ch, CURLOPT_TIMEOUT, 2); | |
curl_setopt($ch, CURLOPT_USERAGENT, _USERAGENT_); |
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
/** | |
* 获取当前 url | |
* @param $use_forwarded_host | |
* @return string | |
*/ | |
function getCurrentUrl($use_forwarded_host = false) { | |
$s = $_SERVER; | |
$ssl = (!empty($s['HTTPS']) && $s['HTTPS'] == 'on'); | |
$sp = strtolower($s['SERVER_PROTOCOL']); | |
$protocol = substr($sp, 0, strpos($sp, '/')) . (($ssl) ? 's' : ''); |
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
.txt{ | |
width:200px; | |
overflow: hidden; | |
white-space: nowrap; | |
text-overflow: ellipsis; | |
} | |
/*有宽高的元素*/ | |
.box { | |
display: -webkit-box; |
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 | |
$uploadUrl = 'http://test.com/upload.php'; | |
// 转发从其它客户端上传的文件,name="file" | |
upload_file($uploadUrl, realpath($_FILES['file']['tmp_name']), $_FILES['file']['type'], $_FILES['file']['name']); | |
/** | |
* curl上传文件 | |
*/ | |
function upload_file($url, $path, $type, $filename){ |
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
header("Access-Control-Allow-Origin: *"); |
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
<style> | |
.text-break { | |
width: 200px; | |
word-wrap: break-word; | |
} | |
</style> | |
<td style="white-space: normal"> | |
<div class="text-break">一大段内容<div> | |
</td> |