本文整理汇总了PHP中header::download方法的典型用法代码示例。如果您正苦于以下问题:PHP header::download方法的具体用法?PHP header::download怎么用?PHP header::download使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类header
的用法示例。
在下文中一共展示了header::download方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
function index()
{
$header = new header();
$header->download("Download");
$content = file_get_contents("https://down.vn/");
preg_match_all('/<div id="content" class="clearfix">(.*?)<div class="clear">/s', $content, $matches, PREG_SET_ORDER);
foreach ($matches as $key) {
}
$data['content'] = $key['1'];
$this->load->view('file/index', $data);
}
示例2: download
public static function download($file, $name = null)
{
// stop the download if the file does not exist or is not readable
if (!is_file($file) or !is_readable($file)) {
return false;
}
header::download(array('name' => $name ? $name : f::filename($file), 'size' => f::size($file), 'mime' => f::mime($file), 'modified' => f::modified($file)));
die(f::read($file));
}
示例3: download
/**
* Forces a download of the string as text file
*
* @param string $string
* @param string $name Optional name for the downloaded file
*/
public static function download($string, $name = null)
{
header::download(array('name' => $name ? $name : 'text.txt', 'size' => static::length($string), 'mime' => 'text/plain'));
die($string);
}
示例4: game
function game($path)
{
$header = new header();
$mydb = $this->load->database('helihost', TRUE);
$query = $mydb->select('*')->from('system_download')->like('path', $path)->get()->result_array();
if ($query) {
$header->download("Download game " . $query[0]['name']);
//$content=file_get_contents($query[0]['path']);
redirect('http://myweb.pro.vn/download/index/');
} else {
$header->download("Download game");
$content = file_get_contents('http://down.vn/game/' . $path);
}
//reset path
//$content=str_replace('<a href="','<a href="/download',$content);
//end
preg_match_all('/<div id="content" class="clearfix">(.*?)<div class="clear">/s', $content, $matches, PREG_SET_ORDER);
foreach ($matches as $key) {
}
//$content=str_replace('href="http://down.vn','href="http://myweb.pro.vn/game',$key['1']);
//$content=str_replace('href="https://down.vn','href="http://myweb.pro.vn/game',$key['1']);
$data['content'] = $content;
$this->load->view('file/index', $data);
}