问题
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