Beispiel #1
0
        if ($email && preg_match('/^[\\w_\\.\\-\\$\\s]+@[\\w_\\.\\-\\$\\s]+$/', $email)) {
            file_put_contents($json, $data);
        }
        echo json_encode($item);
        exit;
    }
    $json = realpath($json);
    $context = null;
    if ($json) {
        $context = file_get_contents($json);
        $context = json_decode($context, true);
    }
    if (!is_array($context)) {
        $context = array();
    }
    $engine->render($path2, $context);
} else {
    $boot = $path == '/doc/boot.js' ? realpath('../WEB-INF/classes/lite/boot.js') : null;
    if (array_key_exists('@', $_GET)) {
        if ($boot) {
            $old_etag = array_key_exists('HTTP_IF_NONE_MATCH', $_SERVER) ? @$_SERVER('HTTP_IF_NONE_MATCH') : 0;
            $etag = @(filemtime($boot) . '-' . filesize($boot));
            if ($old_etag && $old_etag == $etag) {
                header('HTTP/1.1 304 Not Modfied');
                //header('X-INFO-OLD:'.$old_etag);
                //header('X-INFO:'.$etag);
                //header("ETag:".$etag);
                //header("Content-Type:text/javascript;charset=utf-8");
                //exit();
            } else {
                //header("ETag:".$etag);
Beispiel #2
0
<?php

require_once dirname(__FILE__) . "/../WEB-INF/classes/lite/LiteEngine.php";
$engine = new LiteEngine();
# 通过上下文数据方式传递模板参数:
$context = array("int1" => 1, "text1" => '1');
$engine->render("/example/extends-page.xhtml", $context);
Beispiel #3
0
<?php

require_once "../WEB-INF/classes/lite/LiteEngine.php";
$engine = new LiteEngine();
$engine->encoding = "UTF-8";
header("Content-type: text/html;charset=UTF-8");
//初始化Lite Logo 的点阵数据
$data = array();
if (array_key_exists('PATH_INFO', $_SERVER)) {
    $path = $_SERVER['PATH_INFO'];
    $path = '/book' . $path;
} else {
    echo "<script>document.location='index.php/index.xhtml'</script>";
    exit;
}
if (realpath("../" . $path)) {
    if (strpos($path, ".xhtml") > 0) {
        $engine->render($path, $data);
    } else {
        readfile(".." . $path);
    }
} else {
    echo '<h3>找不到文件:' . $path . '</h3>';
}