skunkbad / php-view-loader
1.0.3
2021-12-05 06:45 UTC
Requires
- php: >=5.3
Requires (Dev)
- phpunit/phpunit: 7.5.*
This package is not auto-updated.
Last update: 2024-09-22 19:14:22 UTC
README
此包允许在不依赖任何其他包的情况下加载传统的PHP视图。
简单示例
<?php
// Loads a view named page-content.php and passes
// in the current user, available as $currentUser.
$view = new \Skunkbad\ViewLoader\View;
$view->addPath( __DIR__ . '/views/' );
$view->load('page-content', [
'currentUser' => $currentUser
]);
返回相同的视图,而不是输出它
<?php
$str = $view->load('page-content', [
'currentUser' => $currentUser
], TRUE );