ghostinit.php
class ghostinit{
static $v = 'ghost version is 1.1';
static function init(){
echo "pls input project name?" . PHP_EOL;
$projName = fgets( STDIN );
echo "pls input author?" . PHP_EOL;
$author = fgets( STDIN );
echo self::buildConfig( [ 'proj' => $projName, 'author' => $author ] );
}
static function buildConfig( $info ){
return file_put_contents( getcwd() . '/go.json', json_encode( $info ) ) . ' bytes has written,' . 'config file has created' . PHP_EOL;
}
static function show(){
$conf = json_decode( file_get_contents( getcwd() . '/go.json' ) );
foreach( $conf as $k => $v ){
echo $k . ':' . $v;
}
}
static function getConfig( $conf ){
$std = new stdClass();
foreach( $conf as $k => $v ){
$std->$k = $v;
}
return $std;
}
static function __callstatic( $m, $args ){
echo 'error function';
}
}
?>
希望与广大网友互动??
点此进行留言吧!