本文整理汇总了PHP中render_file函数的典型用法代码示例。如果您正苦于以下问题:PHP render_file函数的具体用法?PHP render_file怎么用?PHP render_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了render_file函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: image_show_jpeg_only
function image_show_jpeg_only()
{
$ext = file_extension(params(0));
$filename = option('public_dir').params(0);
if(params('size') == 'thumb') $filename .= ".thb";
$filename .= '.jpg';
if(!file_exists($filename)) halt(NOT_FOUND, "$filename doesn't exists");
render_file($filename);
}
示例2: render_docs
function render_docs()
{
if (isset($_GET['view']) && !empty($_GET['view'])) {
$filename = $_GET['view'];
$filename = preg_replace('{[\\/]}', ' ', $filename);
echo render_file($filename);
} else {
echo render_file('home');
echo "\n<hr>\n<h3>List of Wiki files</h3>\n";
render_file_list();
}
}
示例3: not_found
/**
* 404 error page.
*/
function not_found($errno, $errstr, $errfile = null, $errline = null)
{
if (strpos($errstr, '/public/soft_images/') !== false) {
render_file('public/img/down.png');
return;
}
before();
set('errno', $errno);
set('errstr', $errstr);
set('errfile', $errfile);
set('errline', $errline);
layout('layout.php');
return html('404.php');
}
示例4: render_limonade_file
/**
* Internal controller that responds to route /_lim_public/**
*
* @access private
* @return void
*/
function render_limonade_file()
{
$fpath = file_path(option('limonade_public_dir'), params('_lim_public_file'));
return render_file($fpath, true);
}
示例5: render_file
<?php
function render_file($file)
{
$x = file($file);
foreach ($x as $line) {
$res .= $line;
}
return $res;
}
# header.txt
echo render_file('header.txt');
echo "<h2>Saltar para o processo:</h2>\n";
echo "<ul>\n";
echo "<li><a href=\"ts.php\">d-i e manual</a></li>\n";
echo "<li><a href=\"debconf.php\">debconf</a></li>\n";
echo "</ul>\n";
echo "<p>Para obter todos os ficheiros que concebem este site:</p>\n";
echo "<div><code>shell\$ svn checkout svn://svn.berlios.de/pdeb/trunk<code></div>\n";
echo "<div><code>shell\$ svn checkout http://svn.berlios.de/svnroot/repos/pdeb/trunk<code></div>\n";
# footer.txt
echo render_file('footer.txt');
?>
示例6: decode_user_key
$user = $cols[1];
$agent = $cols[2];
$user_attr = decode_user_key($user);
$result[$ad_id][] = ['ad_id' => $ad_id, 'user' => $user, 'agent' => $agent, 'age' => $user_attr['age'], 'gender' => $user_attr['gender']];
}
fclose($fp);
return $result;
}
dispatch_get('/', function () {
return render_file(option('public_dir') . '/index.html');
});
dispatch_get('/index.html', function () {
return render_file(option('public_dir') . '/index.html');
});
dispatch_get('/view.html', function () {
return render_file(option('public_dir') . '/view.html');
});
dispatch_post('/slots/:slot/ads', function () {
$advertiser_id = advertiser_id();
if (empty($advertiser_id)) {
return halt(400);
}
$slot = params('slot');
$asset = $_FILES['asset'];
$dir = get_dir('upload');
$tmp_path = $dir . sprintf('/upload-%s', sha1_file($asset['tmp_name']));
if (!move_uploaded_file($asset['tmp_name'], $tmp_path)) {
throw new RuntimeException('Failed to move uploaded file.');
}
$id = next_ad_id();
$key = ad_key($slot, $id);
示例7: substr
$minifiedPathname = TMP_DIR . 'minify' . substr($filename, strlen($modulePath));
if (file_exists($minifiedPathname) == false || filemtime($minifiedPathname) < filemtime($filename)) {
// Is het cache bestand niet up2date?
require_once $modulePath . '/core/bootstrap.php';
if ($extension === 'js') {
$minified = \JSMinPlus::minify(file_get_contents($filename), $filename);
} elseif ($extension === 'css') {
$minified = \CssMin::minify(file_get_contents($filename));
} else {
$minified = ImageOptimizer::minify(file_get_contents($filename), $filename);
}
mkdirs(dirname($minifiedPathname));
if ($minified === false) {
// Minify failed?
copy($filename, $minifiedPathname);
// Use full version
} else {
file_put_contents($minifiedPathname, $minified);
}
}
render_file($minifiedPathname);
}
render_file($filename);
// Render het gewone bestand.
}
}
define('Sledgehammer\\WEBPATH', $webpath);
$folderCount = preg_match_all('/[^\\/]+\\//', substr($uriPath, strlen(WEBPATH)), $match);
define('Sledgehammer\\WEBROOT', str_repeat('../', $folderCount));
//unset($urlPath, $publicFile, $fullpath, $folderCount, $math, $folders, $folder, $files, $filename);
return true;
示例8: function
}).done(function(result) {
$('#downloads').empty();
$.each(result.data, function(index, value) {
$('#downloads').append(
'<li><a href="' + value.html_url
+ '">' + value.name
+ '</a> - ' + value.description + '</li>');
});
});
});
//]]>
</script>
<div id="changelog">
<?php
echo render_file('Changelog', '<h2><a href="/docs/changelog">$title</a></h2>');
?>
</div>
<h3>Source Packages</h3>
<p>The most recent source package is in the master branch of the
<a href="<?php
echo $GIT_REPO_PREFIX;
?>
/arden2bytecode">Git repository</a>.<br>Clone with:</p>
<pre><code>$ git clone <?php
echo $GIT_REPO_PREFIX;
?>
/arden2bytecode.git
</code></pre>
示例9: jpeg_file
function jpeg_file()
{
return render_file(dirname(dirname(__FILE__)) . '/data/deer.jpg');
}
示例10: URL
<div class="card-image">
<img ng-src="{{project.image}}?cache={{project.id}}">
</div>
<div class="card-content">
<span class="card-title truncate"><a ng-href="<?php
echo URL('Project');
?>
?id={{project.id}}" ng-bind-template="{{project.name}}">Unknown Project</a></span>
<span class="by-line">By <a ng-href="<?php
echo URL('User');
?>
?id={{project.creator.id}}" ng-bind-template="{{project.creator.name}}">Unknown User</a></span>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
</main>
<?php
require_once __DIR__ . '/Shared/Partials/Footer.php';
?>
<?php
require_once __DIR__ . '/Shared/Partials/Scripts.php';
?>
<?php
echo render_file('Scripts/Home.js');
?>
</body>
</html>
示例11: http_response_code
if ($_POST['test'] == "true") {
http_response_code(202);
jecho(['status' => "202 Accepted"]);
exit;
}
}
function process_file_upload()
{
global $UPLOAD_DIR;
if (!is_dir($UPLOAD_DIR)) {
mkdir($UPLOAD_DIR);
}
header('Content-Type: application/json');
$protocol = empty($_SERVER['HTTPS']) ? 'http://' : 'https://';
$ext = pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);
$upload_name = randomish() . '.' . $ext;
$upload_file = join_paths($UPLOAD_DIR, $upload_name);
$public_url = $protocol . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] . "/?i=" . $upload_name;
if (move_uploaded_file($_FILES['file']['tmp_name'], $upload_file)) {
jecho(["public_url" => $public_url]);
} else {
jecho(['error' => "Unable to process file upload"]);
}
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
enforce_token();
process_test_connection();
process_file_upload();
} else {
render_file();
}
示例12: _render_file_with_http_cache
function _render_file_with_http_cache($path)
{
if (file_exists($path)) {
if (option('http_cache')) {
$modified_timestamp = filemtime($path);
if ($modified_timestamp) {
http_cache($modified_timestamp);
}
}
render_file($path);
} else {
halt(NOT_FOUND);
}
}