e282486518 / yii2admin Goto Github PK
View Code? Open in Web Editor NEW通用的yii2后台,基于Yii2的advanced应用程序模板,整合RBAC、Menu、Config、Migration多语言、RESTfull等等...
License: Other
通用的yii2后台,基于Yii2的advanced应用程序模板,整合RBAC、Menu、Config、Migration多语言、RESTfull等等...
License: Other
确实autoloader.php 以及缺少htmlpurifier缺少文件
哈哈 哥们可以把前端模板给我一份儿么?
[email protected]
恭喜发财
谢谢哈哈
对权限rbac中规则是在哪里写的呢?,或者说项目中用到规则了么?
composer 下载并install安装完毕,打开后台报错。请问是什么问题?
希望把vendor也加进来,会更好,出错几率更小
使用 composer install 安装出错,下载不了 vendor 第三方扩展包
因为composer install无效,所以下了全站包,解压后执行./yii install提示‘已经安装过’,谢谢
环境php-7.1.1 nginx-1.10
使用全站打包
./yii install 安装后访问 /admin,报错如下
An Error occurred while handling another error:
yii\base\InvalidRouteException: Unable to resolve the request "public/404". in /mnt/hgfs/yii/yii2admin/vendor/yiisoft/yii2/base/Module.php:537
Stack trace:
#0 /mnt/hgfs/yii/yii2admin/vendor/yiisoft/yii2/web/ErrorHandler.php(97): yii\base\Module->runAction('public/404')
#1 /mnt/hgfs/yii/yii2admin/vendor/yiisoft/yii2/base/ErrorHandler.php(111): yii\web\ErrorHandler->renderException(Object(yii\web\NotFoundHttpException))
#2 [internal function]: yii\base\ErrorHandler->handleException(Object(yii\web\NotFoundHttpException))
#3 {main}
Previous exception:
yii\base\InvalidRouteException: Unable to resolve the request "admin/login/login". in /mnt/hgfs/yii/yii2admin/vendor/yiisoft/yii2/base/Module.php:537
Stack trace:
#0 /mnt/hgfs/yii/yii2admin/vendor/yiisoft/yii2/web/Application.php(103): yii\base\Module->runAction('admin/login/log...', Array)
#1 /mnt/hgfs/yii/yii2admin/vendor/yiisoft/yii2/base/Application.php(386): yii\web\Application->handleRequest(Object(common\core\Request))
#2 /mnt/hgfs/yii/yii2admin/web/index.php(24): yii\base\Application->run()
#3 {main}
Next yii\web\NotFoundHttpException: 页面未找到。 in /mnt/hgfs/yii/yii2admin/vendor/yiisoft/yii2/web/Application.php:115
Stack trace:
#0 /mnt/hgfs/yii/yii2admin/vendor/yiisoft/yii2/base/Application.php(386): yii\web\Application->handleRequest(Object(common\core\Request))
#1 /mnt/hgfs/yii/yii2admin/web/index.php(24): yii\base\Application->run()
#2 {main}
新手,请问如何解决,谢谢
本人一直写前端的,现在想自己做点小项目玩一下,请问有没有纯api接口的这种项目,主要编写业务逻辑代码的那种,谢谢~~~
在我的安装版本里面,yii2admin没有安装在网站的根目录,所以有些问题就出现了。
比如首页顶部的轮播图片不显示,比如下部的文章列表前面的小图不出来。
看了一下代码,很明显是 views/index/index.php 里面,没有很好地使用 @web 别名,在用到图片的时候,直接使用了绝对路径。
比如顶部轮播的图片:
<img src="/static/images/assassins1.jpg" alt="第一张幻灯片"
实际上应该写成这样:
<img src="<?=Yii::getAlias('@web/static/images/assassins1.jpg')?>" alt="第一张幻灯片"
下面的正文前小图同样:
<img src="/static/images/01.jpg" />
应该写成
<img src="<?=Yii::getAlias('@web/static/images/01.jpg')?>" />
以上。
视图中的index.php文件中有['id'=>'pjax-container']]); ?> 删掉即可
解决,把前台认证模块删除,或者自己写一个
建立和backend同级文件夹配置好之后报404错误
网上搜索有 还得配置 这个environments/index.php
但是这个项目中是没有这个文件的
作者您好,您的这套程序非常的不错,值得我去学习,但是在安装项目的过程中,遇到了如下问题,还请作者指明问题的所在!
具体的错误提示如下:
Warning: require(/Applications/XAMPP/xamppfiles/htdocs/yii2admin/vendor/composer/../symfony/polyfill-mbstring/bootstrap.php): failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/yii2admin/vendor/composer/autoload_real.php on line 66
Fatal error: require(): Failed opening required '/Applications/XAMPP/xamppfiles/htdocs/yii2admin/vendor/composer/../symfony/polyfill-mbstring/bootstrap.php' (include_path='.:/Applications/XAMPP/xamppfiles/lib/php') in /Applications/XAMPP/xamppfiles/htdocs/yii2admin/vendor/composer/autoload_real.php on line 66
环境配置如下:
1、项目文件yii2admin放置在/Applications/XAMPP/htdocs/文件夹下;
2、Apache配置:
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/Applications/XAMPP/htdocs/yii2admin/frontend/web/"
ServerName www.yii2admin.com
Options FollowSymLinks
AllowOverride All
Order deny,allow
allow from all
ErrorLog "logs/www.yii2admin.com-error_log"
CustomLog "logs/www.yii2admin.com-access_log" common
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/Applications/XAMPP/htdocs/yii2admin/backend/web/"
ServerName admin.yii2admin.com
Options FollowSymLinks
AllowOverride All
Order deny,allow
allow from all
ErrorLog "logs/admin.yii2admin.com-error_log"
CustomLog "logs/admin.yii2admin.com-access_log" common
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/Applications/XAMPP/htdocs/yii2admin/storage/web/"
ServerName storage.yii2admin.com
Options FollowSymLinks
AllowOverride All
Order deny,allow
allow from all
ErrorLog "logs/storage.yii2admin.com-error_log"
CustomLog "logs/storage.yii2admin.com-access_log" common
3、hosts文件设置
#Yii2 sample application
127.0.0.1 www.yii2admin.com
127.0.0.1 admin.yii2admin.com
127.0.0.1 torage.yii2admin.com
麻烦作者您提醒问题出在哪里?应该如何去解决这个问题?谢谢!
Your requirements could not be resolved to an installable set of packages.
Problem 1
- yiisoft/yii2 2.0.x-dev requires bower-asset/yii2-pjax ~2.0.1 -> no matching package found.
- yiisoft/yii2 dev-master requires bower-asset/yii2-pjax ~2.0.1 -> no matching package found.
- yiisoft/yii2 2.0.9 requires bower-asset/jquery 2.2.@stable | 2.1.@stable | 1.11.@stable | 1.12.@stable -> no matching package found.
- yiisoft/yii2 2.0.8 requires bower-asset/jquery 2.2.@stable | 2.1.@stable | 1.11.@stable -> no matching package found.
- yiisoft/yii2 2.0.7 requires bower-asset/jquery 2.2.@stable | 2.1.@stable | 1.11.@stable -> no matching package found.
- yiisoft/yii2 2.0.6 requires bower-asset/jquery 2.1.@stable | 1.11.@stable -> no matching package found.
- yiisoft/yii2 2.0.10 requires bower-asset/jquery 2.2.@stable | 2.1.@stable | 1.11.@stable | 1.12.@stable -> no matching package found.
- Installation request for yiisoft/yii2 >=2.0.6 -> satisfiable by yiisoft/yii2[2.0.10, 2.0.6, 2.0.7, 2.0.8, 2.0.9, dev-master, 2.0.x-dev].
Potential causes:
Read https://getcomposer.org/doc/articles/troubleshooting.md for further common problems.
我按照你的单域名配置之后,启动 apache 过程中遇到了如下的问题
Expected but saw
#
<VirtualHost *:80>
ServerName www.yii2.cn
RewriteEngine on
DocumentRoot d:/php/demo/yii2admin
# 应用前端主要重写规则
RewriteCond %{HTTP_HOST} ^www.yii2.cn$ [NC]
RewriteCond %{REQUEST_URI} !^/(backend/web|admin|storage/web)
RewriteRule !^/frontend/web /frontend/web%{REQUEST_URI} [L]
# 重定向的网页没有一个斜线(注释,如果必要的话)
#RewriteCond %{REQUEST_URI} ^/admin/$
#RewriteRule ^(/admin)/ $1 [L,R=301]
# 禁止斜线重定向
RewriteCond %{REQUEST_URI} ^/admin$
RewriteRule ^/admin /backend/web/index.php [L]
# 后端应用程序的主要重写规则
RewriteCond %{REQUEST_URI} ^/admin
RewriteRule ^/admin(.*) /backend/web$1 [L]
<Directory />
Options FollowSymLinks
AllowOverride None
AddDefaultCharset utf-8
</Directory>
<Directory "d:/php/demo/yii2admin/frontend/web">
RewriteEngine on
# 如果一个目录或一个文件存在,请直接使用请求
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# 否则去请求 index.php
RewriteRule . index.php
Require all granted
</Directory>
<Directory "d:/php/demo/yii2admin/backend/web">
RewriteEngine on
# 如果一个目录或一个文件存在,请直接使用请求
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# 否则去请求 index.php
RewriteRule . index.php
Require all granted
</Directory>
<Directory "d:/php/demo/yii2admin/storage/web">
RewriteEngine on
# 如果一个目录或一个文件存在,请直接使用请求
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# 否则去请求 index.php
RewriteRule . index.php
Require all granted
</Directory>
<filesMatch "\.(env|htaccess|htpasswd|svn|git)">
Require all denied
</filesMatch>
</VirtualHost>
为啥前台有css和js,后台找不到,多了一层admin/
这个没找到在哪儿控制的
这个是前台的样式地址/assets/584fb616/global/plugins/ccslider/css/style.css
这个是后台的样式地址/admin/assets/584fb616/global/css/plugins-md.min.css
多了一层/admin/ 去掉就好了,这个是在哪里控制的?
百度编辑器在控制台报“后台配置项返回格式出错,上传功能将不能正常使用”
改成/web目录时也报这个错。
我正在尝试解决。
其它上传功能正常
下边配置感觉也啥错
'upload' => [
'url' => Yii::getAlias('@storageUrl/image/'),
//'path' => Yii::getAlias('@base/web/storage/image/'), // 服务器解析到/web/目录时,上传到这里
'path' => Yii::getAlias('@storage/web/image/'),
],
/* UEditor编辑器配置 */
'ueditorConfig' => [
/* 图片上传配置 */
'imageRoot' => Yii::getAlias("@storage/web"), //图片path前缀
//'imageRoot' => Yii::getAlias("@base/web/storage"), //图片path前缀,服务器解析到/web/目录时,上传到这里
'imageUrlPrefix' => Yii::getAlias('@storageUrl'), //图片url前缀
'imagePathFormat' => '/image/{yyyy}{mm}/editor{time}{rand:6}',
/* 文件上传配置 */
'fileRoot' => Yii::getAlias("@storage/web"), //文件path前缀
//'fileRoot' => Yii::getAlias("@base/web/storage"), //文件path前缀,服务器解析到/web/目录时,上传到这里
'fileUrlPrefix' => Yii::getAlias('@storageUrl'), //文件url前缀
'filePathFormat' => '/file/{yyyy}{mm}/editor{rand:4}_{filename}',
/* 上传视频配置 */
'videoRoot' => Yii::getAlias("@storage/web"),
//'videoRoot' => Yii::getAlias("@base/web/storage"), // 服务器解析到/web/目录时,上传到这里
"videoUrlPrefix" => Yii::getAlias('@storageUrl'),
'videoPathFormat' => '/video/{yyyy}{mm}/editor{time}{rand:6}',
/* 涂鸦图片上传配置项 */
'scrawlRoot' => Yii::getAlias("@storage/web"),
//'scrawlRoot' => Yii::getAlias("@base/web/storage"), // 服务器解析到/web/目录时,上传到这里
"scrawlUrlPrefix" => Yii::getAlias('@storageUrl'),
'scrawlPathFormat' => '/image/{yyyy}{mm}/editor{time}{rand:6}',
],
FRONTEND_URL = /yii2admin/frontend/web
BACKEND_URL = /yii2admin/backend/web
STORAGE_URL = /yii2admin/storage
# 前台重写
location /yii2admin/frontend/web/ {
try_files $uri /yii2admin/frontend/web/index.php?$args;
}
# 后台重写
location /yii2admin/backend/web/ {
try_files $uri /yii2admin/backend/web/index.php?$args;
}
(原doc/nginx.conf示例文件中没有这一部分,经测试,可用)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.