public function actionGetUrlList()
{
echo "当前域名地址:".Yii::$app->request->hostInfo."<br>"; // http://localhost
echo "当前目录物理路径:".Yii::$app->basePath."<br>"; // D:/wamp/Apache2.2/htdocs/visualization/backend
echo "当前项目路径:".dirname(Yii::$app->BasePath)."<br>"; // D:/wamp/apache2.2/htdocs/visualzation
echo "当前Url: ".Yii::$app->request->url."<br>"; // /visualization/backend/web/index.php?r=site/get-url
echo "当前Home Url: ".Yii::$app->homeUrl."<br>"; // /visualizaton/backend/web/index.php
echo "当前return Url: ".Yii::$app->user->returnUrl."<br>"; // /visualization/backend/web/index.php
echo "获取当前模块ID方法:".Yii::$app->controller->module->id."<br>"; // app-backend
echo "获取当前控制器的ID方法:".Yii::$app->controller->id."<br>"; // site
echo "获取当前action的ID方法:".Yii::$app->controller->action->id."<br>"; // get-url
echo "ip地址: ".Yii::$app->request->userIP."<br>"; // 127.0.0.1
}
本文链接:https://main.itffz.cn/archives/30.html