Controller Function Without Rendering View in CakePHP

Rendering CakePHP controller function without view is one of the common issues, faced by CakePHP developers. I myself had to search for hours to find this solution and thought to share this with you people. There are many occasions when you don’t want CakePHP controller or function to have a view file to render, to disable this you need to write the below code to do this magic for you.

CakePHP controller function without view

 

Just write down this code in your CakePHP controller function and it will disable rendering and code will stop looking for view file:

 

$this->autoRender = false;

 

Hope it solves your problem.

Please like and share if it, helped you!

“I am PHP Freelancer having more than 7 years of experience, if you want to do any project with me then you can contact me.”

Be Social, Share!