update to 1.2.1

add phar build script
This commit is contained in:
whale
2020-05-02 23:27:26 +08:00
parent 97e579b8a1
commit 82a1f86bbd
19 changed files with 292 additions and 119 deletions

View File

@@ -1,9 +1,14 @@
<?php
use Framework\Console;
use Framework\DataProvider;
use Framework\ZMBuf;
use ZM\Context\ContextInterface;
function isPharMode(){
return substr(__DIR__, 0, 7) == 'phar://';
}
function classLoader($p) {
$filepath = getClassPath($p);
if ($filepath === null)
@@ -19,11 +24,16 @@ function classLoader($p) {
function getClassPath($class_name) {
$dir = str_replace("\\", "/", $class_name);
$dir = WORKING_DIR . "/src/" . $dir . ".php";
//echo "@@@".$dir.PHP_EOL;
$dir = str_replace("\\", "/", $dir);
if (file_exists($dir)) return $dir;
else return null;
$dir2 = WORKING_DIR . "/src/" . $dir . ".php";
//echo "@@@".$dir2.PHP_EOL;
$dir2 = str_replace("\\", "/", $dir2);
if (file_exists($dir2)) return $dir2;
else {
$dir = DataProvider::getWorkingDir() . "/src/" . $dir . ".php";
//echo "###".$dir.PHP_EOL;
if (file_exists($dir)) return $dir;
else return null;
}
}
/**