Detailed production tutorial of PHP API
This article mainly explains the "PHP API detailed production tutorial", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "PHP API detailed production tutorial" bar!
Method 1: return the picture directly
Step 1: first of all, you have to put the link of the picture line-by-line typesetting into the txt document as follows:
Step 2: use the following php code as follows
Attention part
$filename = "img.txt"
For reading the img.txt document, the picture is linked in the txt document, which should be in the same directory as the php file, as shown in figure 1.
The effect of running the php is as follows:
Method 2: return json
The php code is as follows:
The same as the above method, such as I read the cai.txt document, then my cai.txt document is a picture link, in the form of a line, a picture link into a line, do not appear blank lines.
The running effect is as follows:
Concluding remarks:
Personally made api for learning to hang robots, I prefer the api of method 2.
Of course, if you want to hang up the server, you will put txt and php under your domain name. For example, I put it in the following path:
So one of the things I want to visit is:
Https://yanghanwen.xyz/tu/ren.php thank you for reading, the above is the "detailed production of PHP API tutorial" content, after the study of this article, I believe you have a deeper understanding of the detailed production of PHP API tutorials, the specific use of the need for you to practice and verify. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!