What is the reason why the yii verification code does not refresh?
The background login calls the verification code. Clicking the verification code does not refresh and there is no response (all verification codes Configuration and parameters are correct).
When I found the error, I found that the page where the verification code can be refreshed has an extra js code than the page where the verification code cannot be refreshed, which is used to handle the event of clicking the verification code to refresh.
(Related tutorial recommendation: yii framework)
Why is there a piece of code missing? It turns out that the controller calls renderPartial and render respectively. Let’s talk about their differences:
When rendering page output.
render Outputs the content of the parent template and embeds the rendered content into the parent template.
renderPartial does not output the content of the parent template. Only the partial content of this rendering is output.
At the same time, there is an important difference:
The processOutput($output) function is executed by default inside the render function, and the required scripts registered in CClientScript in components such as CTreeView will be rendered. output.
And renderPartial() does not automatically render and output the client script by default. Parameters need to be specified before it will be output:
renderPartial($view,$data=null,$return=false,$processOutput=false)
Specify processOutput as true.
Just like the problem we encountered, when using renderPartial, the page does not output the js that refreshes the verification code. So there is no reaction.
PHP Chinese website, a large number of PHP video tutorials, welcome to learn!
The above is the detailed content of Why does the yii verification code not refresh?. For more information, please follow other related articles on the PHP Chinese website!