Problems related to method calls in common. php in ThinkPHP
Source: Internet
Author: User
In ThinkPHP, I created a public function file common. php in the project Common, and wrote a toHtml () method in it. Then, you can directly call {$ list. article_content | toHtml =###} in the html template to call the methods in common. php in ThinkPHP.
I created a public function file Common. php in the project common, and wrote a toHtml () method in it.
Then, you can directly call {$ list. article_content | toHtml =###} in the html template ###}
This is correct. how can I execute this operation in a small project,
What about Call to undefined function toHtml () in another slightly complicated project?
------ Solution --------------------
Use standard syntax to check whether the call is successful
TP groups. the common. php directory is different.
------ Solution --------------------
Check whether the file is loaded and use the native php code to test whether the file is successful.
------ Solution --------------------
Is it 2.0?
2.0 of available {: function ()}
If not, you can directly use the php source code.
If the methods in common. php are loaded successfully, they can be called directly in the template and program.
------ Solution --------------------
It is best to use native. I like to use native in any framework.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.