How does ZendFramework import its own class? I want to add an image processing class in ZendFramework. some methods I can see on the Internet through the manual are reported as errors. why? I put ImageProcessing. php in application \ Controller \ Pl ZendFramework. how can I import my own class?
I want to add an image processing class in ZendFramework. some methods I can see on the Internet through the manual are reported as errors. why?
I put ImageProcessing. php in the application \ Controller \ Plugin directory,
Content
Class Custom_Controller_Plugin_ImageProcessing extends Zend_Controller_Plugin_Abstract {
......
}
Then use it in textAction (), Zend_Loader: loadClass ('m M _ Controller_Plugin_ImageProcessing ');
Error:
Assembly code
Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (error)' in F:\web\my\library\Zend\Controller\Dispatcher\Standard.php:248 Stack trace: #0 F:\web\my\library\Zend\Controller\Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #1 F:\web\my\index.php(28): Zend_Controller_Front->dispatch() #2 {main} Next exception 'Zend_Controller_Exception' with message 'Invalid controller specified (error)#0 F:\web\my\library\Zend\Controller\Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #1 F:\web\my\index.php(28): Zend_Controller_Front->dispatch() #2 {main}' in F:\web\my\library\Zend\Controller\Plugin\Broker.php:336 Stack trace: #0 F:\web\my\library\Zend\Controller\Front.php(965): Zend_Controller_Plugin_Broker->postDispatch(Object(Zend_Controller_Request_Http)) #1 F:\web\my\index.php(28): Zend_Contr in F:\web\my\library\Zend\Controller\Plugin\Broker.php on line 336
This is done according to the methods described by others on the internet. Is it because I have created a plug-in folder under the Controller Directory? where can I set the plug-in path?
Index. php file code:
PHP code
SetFallbackAutoloader (true); // automatically load class files in static mode $ registry = Zend_Registry: getInstance (); $ view = new Zend_View (); $ view-> setScriptPath ('. /tpl/'); // set the template display path // $ view-> setHelperPath ('. /tpl/'); // Set the display path $ registry ['View'] = $ view; // register view // configure database parameters, connect to the database $ config = new Zend_Config_Ini ('. /application/config. ini ', null, true); Zend_Registry: set ('config', $ config); $ dbAdapter = Zend_Db :: factory ($ config-> general-> db-> adapter, $ config-> general-> db-> config-> toArray ()); $ dbAdapter-> query ('set NAMES utf8'); Zend_Db_Table: setdefaadapter adapter ($ dbAdapter); Zend_Registry: SET ('dbadapter ', $ dbAdapter); Zend_Registry :: set ('dbprefix', $ config-> general-> db-> config-> prefix); // set the controller $ frontController = Zend_Controller_Front: getInstance (); $ frontController-> setBaseUrl ('/') // set the basic path-> setParam ('noviewrenderer', true)-> setControllerDirectory ('. /application/Controller ')-> dispatch (); //-> throwExceptions (true)
I also put this class under the application \ Views \ helpers directory,
Content: class Zend_View_Helper_ImageProcessing extends Zend_View_Helper_Abstract {......}
The same error is reported.
This problem has been around for several days. I hope you can help me.
Another small problem is that in thinkphp, if you want to add your own public functions, you can add them in common/common. php. how can zendframework be added?
------ Solution --------------------
Or you can use this, but it's a little far-fetched.
Http://blog.csdn.net/mengxiangbaidu/article/details/7345108
The \ Views \ helpers custom assistant method. Not written. Write again in two days.
Or you can directly include. This is acceptable.