Home > php教程 > php手册 > Elementary notes on Thinkphp

Elementary notes on Thinkphp

WBOY
Release: 2016-07-06 13:28:17
Original
848 people have browsed it

Starting words:

To be honest, this is my first time building a website, so I directly chose ThinkPHP, an open source framework. Reasons for choosing this framework. . . I don’t remember anymore

It seems that this was the only one I knew at the time, and other better frameworks were learned later in this graduation project. When I think about it, I feel relatively

As I use Java to develop web, I feel that the direct parsability of PHP is more convenient for development and can save me a lot of work = =Then I started to learn PHP by myself (

I gave the front end to my classmate, luckily).

Note 1-How to call a method (function) in the Controller class?

When I first started developing, according to my previous object-oriented understanding, I placed the method in the Controller and called it directly. Then I found that it was not possible and I had to

Place the method (public) in the function.php file of the Public module or its own Model, or you can create a new one to call it.

Attention point 2-The essence of the Html file

In the Thinkphp framework, since the framework itself will parse the html file, this will allow you to customize tags. You can use , , and other tags

For example:

<span style="color: #008080;">1</span> <span style="color: #0000ff;"><</span><span style="color: #800000;">include </span><span style="color: #ff0000;">file</span><span style="color: #0000ff;">="Temp/temp_leftmenu"</span> <span style="color: #0000ff;">/></span>
Copy after login
<span style="color: #008080;">1</span> <span style="color: #0000ff;"><</span><span style="color: #800000;">switch </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="file.type"</span><span style="color: #0000ff;">></span>
<span style="color: #008080;">2</span>     <span style="color: #0000ff;"><</span><span style="color: #800000;">case </span><span style="color: #ff0000;">value</span><span style="color: #0000ff;">="dir"</span><span style="color: #0000ff;">><</span><span style="color: #800000;">a </span><span style="color: #ff0000;">href</span><span style="color: #0000ff;">="{:U('Other/material',array('dir' => urlencode($file['name'])))}"</span><span style="color: #0000ff;">></span>{$file['filename']}<span style="color: #0000ff;"></</span><span style="color: #800000;">a</span><span style="color: #0000ff;">></</span><span style="color: #800000;">case</span><span style="color: #0000ff;">></span>
<span style="color: #008080;">3</span>     <span style="color: #0000ff;"><</span><span style="color: #800000;">case </span><span style="color: #ff0000;">value</span><span style="color: #0000ff;">="pdf|html|jpeg|png|mp4"</span><span style="color: #0000ff;">><</span><span style="color: #800000;">a </span><span style="color: #ff0000;">id</span><span style="color: #0000ff;">="{:hash('md5',$file['name'])}"</span><span style="color: #0000ff;">></span>{$file['filename']}<span style="color: #0000ff;"></</span><span style="color: #800000;">a</span><span style="color: #0000ff;">></</span><span style="color: #800000;">case</span><span style="color: #0000ff;">></span>
<span style="color: #008080;">4</span>     <span style="color: #0000ff;"><</span><span style="color: #800000;">default </span><span style="color: #0000ff;">/></span><span style="color: #000000;">{$file['filename']}
</span><span style="color: #008080;">5</span> <span style="color: #0000ff;"></</span><span style="color: #800000;">switch</span><span style="color: #0000ff;">></span>
Copy after login

This makes me, who is not very familiar with the web, very happy.

Conclusion:

It’s really a long time ago. . . I have forgotten a lot of things, so I will write this much first.

There is really little information online, so the official website documents are of great help to me.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template