zuixian113 2018-12-05 18:19:31 331次浏览 1条回复 6 3 0

1、源代码:

public function actionGetUrlList()
{
    echo "当前域名地址:".Yii::$app->request->hostInfo."<br>";
    echo "当前目录物理路径:".Yii::$app->basePath."<br>";  
    echo "当前项目路径:".dirname(Yii::$app->BasePath)."<br>";
    echo "当前Url: ".Yii::$app->request->url."<br>";
    echo "当前Home Url: ".Yii::$app->homeUrl."<br>";
    echo "当前return Url: ".Yii::$app->user->returnUrl."<br>";
    echo "获取当前模块ID方法:".Yii::$app->controller->module->id."<br>";
    echo "获取当前控制器的ID方法:".Yii::$app->controller->id."<br>";
    echo "获取当前action的ID方法:".Yii::$app->controller->action->id."<br>";
    echo "ip地址: ".Yii::$app->request->userIP."<br>";
}

2、访问路径 http://localhost/visualization/backend/web/index.php?r=site/get-url-list 显示如下: 显示路径.png

觉得很赞
亿速云
您需要登录后才可以回复。登录 | 立即注册