My table is news, and I wrote the model. Now I have a problem in the model. I don’t know if a variable has a value. I found that I can’t just dump the variable directly on any page, such as the view page, like a controller. The value of this variable can be displayed on the view page
On the model page, if I write any public function, I can’t dump it if I write something in it. I want to see the variables printed in my model on the news list page or the view page. What should I do? How do I debug this?
Asking for help from an expert, thank you
My table is news, and I wrote the model. Now I have a problem in the model. I don’t know if a variable has a value. I found that I can’t just dump the variable directly on any page, such as the view page, like a controller. The value of this variable can be displayed on the view page
On the model page, if I write any public function, I can’t dump it if I write something in it. I want to see the variables printed in my model on the news list page or the view page. What should I do? How do I debug this?
Asking for help from an expert, thank you
Call the method in the model you wrote in the controller of your news page, and you can see the dump data in the model
The reason why the dump cannot come out is probably because that piece of code has not been executed.
If you pass data to view
<code>$this->assign('data',$data);</code>
You can also insert it in the html page of the view
<code><?php dump($data); ?></code>
In the model, the dump can be displayed directly on the page. If it is not displayed, there is something wrong with the code. Post the controller code and take a look.