简体   繁体   English

Yii框架中的资产

[英]Assets in Yii Framework

Can somebody explain in brief the use of assets folder in yii framework. 有人可以在yii框架中简要解释资产文件夹的使用。 I am new to yii framework 我是yii框架的新手

Many newcomers ask: "What do we do with the assets folder?", and the answer is "Mostly nothing". 许多新人问:“我们如何处理资产文件夹?”,答案是“绝对没有”。

  • It's important that the directory be writable by the webserver user so that Yii can publish the resources there when needed. 重要的是,目录可以由webserver用户写入,以便Yii可以在需要时发布资源。
  • When a project has multiple versions (production, testing, development, etc.) do not copy the assets/ folders from one area to another; 当项目有多个版本(生产,测试,开发等)时,不要将资产/文件夹从一个区域复制到另一个区域; allow Yii to deploy them automatically in each area. 允许Yii在每个区域自动部署它们。
  • Do not manually edit any file under assets/ - if you have a real need to make a change, find the publishing module, edit the source, delete the subfolder under assets/, and let Yii re-publish the updated files. 不要手动编辑assets /下的任何文件 - 如果您确实需要进行更改,找到发布模块,编辑源,删除assets /下的子文件夹,让Yii重新发布更新的文件。
  • Do not reference names under the assets/ folder directly (say, to get at some other module's assets). 不要直接引用assets /文件夹下的名称(比如,获取其他模块的资产)。 If you need to use that 如果你需要使用它
  • Do not add the contents of the assets/ folder to any source-code control system; 不要将assets /文件夹的内容添加到任何源代码控制系统; these files have master source in other places. 这些文件在其他地方有主要来源。
  • It is safe to delete everything under assets/. 删除assets /下的所有内容是安全的。 Yii will re-publish the assets if they are not found under assets/. 如果资产不在资产/下,Yii将重新发布资产。

Additional info 附加信息

Yii makes assets accessible by Web clients, so the goal of copying assets to a Web-accessible directory is fulfilled and returns the corresponding URL for accessing them. Yii使Web客户端可以访问资产,因此实现了将资产复制到Web可访问目录的目标,并返回相应的URL以访问它们。

Read it from http://www.yiiframework.com/doc/api/1.1/CAssetManager 请阅读http://www.yiiframework.com/doc/api/1.1/CAssetManager

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM