-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelpers.php
38 lines (31 loc) · 895 Bytes
/
helpers.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
use \Probeyang\Sherlock\Core\Web\WebController;
if (!function_exists('view')) {
/**
* Get the evaluated view contents for the given view.
*
* @param string $view
* @param array $data
* @return \Probeyang\Sherlock\Core\Web\ViewController
*/
function view($view = null, $data = array()) {
$factory = new WebController();
return $factory->make($view, $data);
}
}
if (!function_exists('baseDir')) {
/**
* 获取框架的根目录路径
*
* @return type
*/
function baseDir() {
if (!defined('BASE_DIR')) {
$routerDir = DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'probeyang' . DIRECTORY_SEPARATOR . 'sherlock';
$baseDir = str_replace($routerDir, '', __DIR__);
} else {
$baseDir = BASE_DIR;
}
return $baseDir;
}
}