久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

在 CakePHP 2.0 中加載供應商文件

Loading Vendor Files in CakePHP 2.0(在 CakePHP 2.0 中加載供應商文件)
本文介紹了在 CakePHP 2.0 中加載供應商文件的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我目前正在將我們的一個項目升級到 CakePHP 2.0.不幸的是,代碼的第一行"出現了問題,我找不到解決該問題的方法.

I'm currently upgrading one of our projects to CakePHP 2.0. Unfortunately the "first line" of code makes problems, and I can't find a solution to that problem.

在 CakePHP 1.3 中,我在定義 AppController 類之前有一個 App::import("Vendor", "facebook"); 語句.引用的文件位于 /app/vendors/facebook/facebook.php 下(并包括 base_facebook.php 文件).

In CakePHP 1.3 I had an App::import("Vendor", "facebook"); statement right before the AppController class gets defined. The referenced file is located under /app/vendors/facebook/facebook.php (and includes itself the base_facebook.php file).

根據此處描述的文件命名和類加載,我嘗試了許多不同的方法將文件包含在 CakePHP 2.0 中:CakePHP 2.0 文件命名和類加載變化

I tried many different ways to include the file now in CakePHP 2.0 according to the File naming and class loading described here: File naming and class loading changes in CakePHP 2.0

我將路徑重命名為app/Vendor/Facebook/Facebook.php,或app/Vendor/Facebook/facebook.php,并嘗試了以下方法:>

I renamed the path to app/Vendor/Facebook/Facebook.php, or app/Vendor/Facebook/facebook.php, and tried following methods:

App::uses("Facebook", "Vendor/Facebook");
App::uses("Facebook", "Facebook");
App::uses("Facebook", "Vendor/Facebook/Facebook.php");
App::uses("Facebook", "Vendor");

有沒有人找到引用供應商文件的方法?由于延遲加載,上述方法不會觸發錯誤/警告,因此調試它有點煩人......

Has anyone find a way to reference a vendor file yet? Because of the lazy loading the methods above do not fire an error/warning, so it's kind of annoying to debug this...

推薦答案

在 CakePHP 中無法使用 App::uses() 加載供應商,這是因為 CakePHP 不能期望外部庫遵循相同有關文件夾和文件命名的標準.您仍然可以像在框架的 1.3 版中那樣使用 App::import('Vendor', ...).

Vendors cannot be loaded using App::uses() in CakePHP, this is because CakePHP cannot expect external libraries to follow the same standards regarding folder and file naming. You can still use App::import('Vendor', ...) as you did in version 1.3 of the framework.

現在,如果您考慮一下,為供應商使用 App::import() 有點愚蠢.它只是 require_once() 的一個昂貴、冗長且非常愚蠢的包裝器.

Now, using App::import() for vendors is kind of silly, if you think about it. It is just an expensive, verbose and very silly wrapper for require_once().

在 2.0 中,我們實際上鼓勵人們為他們的供應商庫使用 require 或 require_once.您可以使用 App::path('Vendor') 或僅使用 APP 來獲取 Vendor 文件夾的位置.'小販' .DS.

In 2.0, we actually encourage people to use require or require_once for their Vendor libraries. You can get the location of the Vendor folder using App::path('Vendor') or just APP . 'Vendor' . DS.

這篇關于在 CakePHP 2.0 中加載供應商文件的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Cannot use #39;Object as class name as it is reserved Cake 2.2.x(不能使用 Object 作為類名,因為它是保留的 Cake 2.2.x)
Session is lost after an OAuth redirect(OAuth 重定向后會話丟失)
Pagination Sort in Cakephp 3.x(Cakephp 3.x 中的分頁排序)
CakePHP Shared core for multiple apps(CakePHP 多個應用程序的共享核心)
Login [ Auth-gt;identify() ] always false on CakePHP 3(在 CakePHP 3 上登錄 [ Auth-identify() ] 始終為 false)
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 87 bytes)(致命錯誤:允許的內存大小為 134217728 字節已用盡(嘗試分配 87 字節))
主站蜘蛛池模板: 久久国色| 中文字幕在线播放第一页 | 日韩精品视频一区二区三区 | 在线视频成人 | 91精品国产91综合久久蜜臀 | 一本色道精品久久一区二区三区 | 九九综合九九 | 久久久精品视频一区二区三区 | 成人黄色电影免费 | 久草视频观看 | 日本成人中文字幕 | 国产乱码精品一品二品 | 免费看国产一级特黄aaaa大片 | 夜夜骚| 欧美一级片免费看 | 欧美一区二区三区在线播放 | 美女福利视频网站 | 国产在线永久免费 | 性欧美精品一区二区三区在线播放 | 婷婷久| a级毛片基地 | 一本色道久久综合亚洲精品高清 | 性在线 | 视频在线h| 欧美精品综合在线 | 美女福利视频网站 | 亚洲福利在线观看 | 免费视频一区二区 | 一级一级毛片免费看 | 91极品欧美视频 | 日韩一区精品 | 91精品国产综合久久婷婷香蕉 | 91操操操 | 国产精品亚洲一区二区三区在线 | 91精品在线观看入口 | 成年人在线 | 亚洲成人一区二区 | 美女黄网 | 欧美一二三区 | 久久久久久九九九九九九 | 精品久久久久国产 |