nathanwooten / pathfind
一个简单的路径查找器。
1.1.0
2023-04-01 07:07 UTC
Requires
- php: ^7.3
README
根据内容在结构中找到路径。
<?php // entry-point/index.php require dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'bootstrap.php'; $pathFind = $pathFind->withPath( parse_url( $_SERVER[ 'REQUEST_URI' ], PHP_URL_PATH ) ); $pathFind = $pathFind->withContains( [ 'header.php' ] ); require $pathFind . DS . 'header.php'; // your app $pathFind = $pathFind->withContains( [ 'footer.php' ] ); require $pathFind . DS . 'footer.php';
<?php // bootstrap.php, this is loaded before pathFind is used in the index file require_once dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'PathFind.php'; $pathFind = new PathFind; $pathFind->pathFind( __FILE__, [ 'public_html' ] ) . DS . 'main' . DS . 'lib.php';