1.代码方式
<?php
function getRemoteLmlPhp(){
$cache_filename = 'lml.min.php';
$remotelib = 'http://git.oschina.net/leiminglin/LMLPHP/raw/master/lml.min.php';
if( file_exists( $cache_filename ) ) {
$cachemtime = filemtime($cache_filename);
if( $cachemtime + 86400 > time() ){
require $cache_filename;
return;
}
$header = get_headers($remotelib);
$lastmtime = 0;
foreach ($header as $k){
if( preg_match('/^Last-Modified:/i', $k) ){
$lastmtime = strtotime(preg_replace('/^Last-Modified:/i', '', $k));
break;
}
}
if( $lastmtime <= $cachemtime ){
touch($cache_filename);
require $cache_filename;
return;
}
}
$code = file_get_contents( $remotelib );
file_put_contents($cache_filename, $code);
eval('?>'.$code);
}
getRemoteLmlPhp();
2.GITHUB项目地址
https://github.com/leiminglin/LMLPHP3.GITOSC项目地址
http://git.oschina.net/leiminglin/LMLPHP4.使用Composer创建LMLPHP项目
运行 composer require leiminglin/lmlphp
index.php 示例:
<?php
require __DIR__.'/../vendor/autoload.php';
define('APP_DIR', __DIR__.'/../app');
lml()->app()->run();
运行 php index.php 创建项目。