Update webapp.php

This commit is contained in:
Namhyeon Go 2019-03-08 01:37:13 +09:00 committed by GitHub
parent 2263dff0cf
commit 215beed570
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,7 +32,7 @@ $self_filename = "";
$routes = read_route_all();
// set path and URL
$webapp_root = $_SERVER["DOCUMENT_ROOT"] . "webapp";
$webapp_root = $_SERVER["DOCUMENT_ROOT"] . "/webapp";
$webapp_url = base_url() . "webapp";
// set DOCUMENT_ROOT forcely
@ -40,6 +40,7 @@ $_SERVER["DOCUMENT_ROOT"] = $webapp_root;
// set file path
$appfile = $webapp_root . "/" . implode("/", $routes);
$appfile_path = $appfile . ".php";
// get end of routes
@ -88,13 +89,15 @@ if($is_redirect_to_index == true) {
if($is_static_file == true) {
if(file_exists($appfile)) {
set_header_content_type($end_era);
header("Cache-Control: max-age=86400");
$fp = fopen($appfile, "r") or die("file does not exists");
$fp = fopen($appfile, "r") or die("404 Not Found");
while(!feof($fp)) {
echo fread($fp, 8192);
}
fclose($fp);
} else {
echo "File Not Found";
set_error("404 Not Found");
show_errors();
}
}