Call to undefined method App::uses() - cakephp - CakeEmail

扶醉桌前 提交于 2020-01-06 15:41:34

问题


I am trying to setup CakeEmail to use my gmail as my isp blocks port 25.

However, I am having a very frustrating problem trying to load the App::uses class.

I have tried placing it in many different locations and I still get the following error.

Fatal error: Call to undefined method App::uses() in C:\www\ash\app\controllers\songrequests_controller.php on line 3 

I am not sure whats going on. Am I not loading something properly, or am I not placing it in the correct place?

<?php

App::uses('CakeEmail', 'Network/Email');
class SongrequestsController extends AppController {

http://book.cakephp.org/2.0/en/core-utility-libraries/email.html

Thanks for any help. Regards,


回答1:


App::uses() is a method introduced in CakePHP 2.x, whereas it seems like you are using CakePHP 1.x, hence the error.

So you either have to upgrade to CakePHP 2.x (which I recommend) or use CakePHP 1.x's approach for sending emails described in http://book.cakephp.org/1.3/en/view/1283/Email.



来源:https://stackoverflow.com/questions/12027222/call-to-undefined-method-appuses-cakephp-cakeemail

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!