Continuing from the previous article PHP Example Webzine Editing and Sending (1) List 3: Create HTML table $anchor
"); } ?> This table starts and ends in HTML mode, but most of its intermediate steps are in PHP mode. Now let's analyze this example line by line. It starts in HTML mode (which is the normal starting mode for PHP). The table has a border width of 1: Now, switch to PHP mode: $anchor
"); The following echoe statement inserts the specified string into the output stream (i.e., the body of the HTML page). So you can use this statement to insert an entire table row. Use " in a string to insert a quote character. The $color and $anchor variables calculated above are automatically substituted into their reference positions: echo("
$anchor
"); End of the for loop: } Return again from PHP mode to HTML mode: ?> End of the HTML table of the category menu: This ends the analysis of the program creation process! Representation of stories Once you have selected a story, you need to The text of the story is printed from the story file to the current web page. (The editor module author.php3 prepares the story in the correct HTML format.) In the following code snippet, it is assumed that the story number is stored in the variable $. story. If $story is equal to 33, the file of this story is s33.txt. $storyfile = fopen("s$story.txt","r"); fpassthru($storyfile); In the above example, the fopen function Opens a file and returns a handle to the file, which is then saved in the variable $storyfile via the assignment operator. The fpassthru function copies the contents of the file to the current output device (output HTML file) and automatically closes the file. Content preview This article (Part 1.2) introduces the first part of Webzine, a simple PHP application, and analyzes a few small code examples in detail (this part of the application is only 2K in size, so there are not many large code examples for us. Select!) This should give you a good taste of the power of PHP, but there's more to come. The next section is roughly the same length as the previous one and I'll explain how the story menu is presented to the reader. , thus completing the discussion of the Send module. I will then discuss the Edit module, which allows authors to submit stories. Although the Edit module is much larger than the Send module, we will not discuss it in such detail: we will only explain what is different from the Send module. Interesting concepts. References PHP.net is the official homepage for the PHP language. Here you can download the latest version of PHP for free and see where PHP development is headed. There is also a FAQ, a manual, and many other resources. . PHPbuilder.com is aimed at developers and contains numerous articles and code samples, job listings, and links to PHP resources.Webmonkey's PHP section contains a wealth of introductory-level articles about PHP.
http://www.bkjia.com/PHPjc/531913.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/531913.htmlTechArticleContinued from the previous article PHP example Webzine editing and sending (1) Listing 3: Create HTML table $anchor ); } ?> This table starts and ends in HTML mode, but most of its intermediate steps are in PHP mode...