5 programs for beginners to learn PHP_PHP Tutorial

WBOY
Release: 2016-07-21 16:00:45
Original
893 people have browsed it

The basic syntax format of PHP is similar to that of C. Friends who have never learned C will be basically familiar with the format if they spend a few minutes looking at how other people's source code is written.
-------------------------------------------------- -----
Let’s get to the point
Prepared 5 programs:
1. Use a basic function, the result is in the form of a string, and display it with echo
2. Display a beautiful Form
3. A form example, submit and display the submission results
4. Database manipulation example (voting program)
5. Dynamically create graphics and save examples
-------- -----------------------------------------------
#Program 1 :
/* Function: Display the configuration environment and various parameter variables of PHP and APACHE*/
echo phpinfo();/* PHP has a rich function library and a large number of convenient functions Greatly improve your work efficiency. phpinfo() is one of the functions*/
?>
-------------------------------- --------------------
#Program 2:
/* Function: Display a beautiful table

< ;HEAD>
A beautiful table

{
/*
** Please remember the last color tag we used
*/
static $ColorValue;
/* Select the next color */
if($ColorValue == "#00FF00")
{
$ColorValue = "#CCFFCC";
}
else
{
$ColorValue = "#00FF00";
}
return($ColorValue);
}
print "

";
for($count=0; $count > 6; $count++)
{
/*
** Get the color of the current row
*/
$RowColor = useColor();
/*
** Use HTML language for the background color
** Output to table cell
*/
print " ";
}
print "
";
print "
";
?>


--------------------------------- ------------------
#Example 3
if($send)
{
echo "Send the result :$send";
exit;
}
?>



< ;form action= method=post>






---------------- ------------------------------------
#Example 4: Voting procedure
Here :http://www.21php.com/forums/showthread.php?s=&threadid=524
#Example 5: Dynamically create and save graphics
Header("Content-type:image/jpeg");
$im=imagecreate(400,30);
$black=ImageColorAllocate($im,0,0,0);
$white= ImageColorAllocate($im,255,255,255);
ImageTTFText($im,20,0,10,20,$white,"c:windowsfontsRaavi.ttf","i am kinter");
ImageJpeg($im, "hello.jpeg");
ImageDestroy($im);
?>


http://www.bkjia.com/PHPjc/317072.html

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/317072.htmlTechArticleThe basic syntax format of PHP is similar to C. Friends who have not learned C should spend a few minutes to look at other people’s source codes. How to write it, you are basically familiar with the format. --------------------------------------------------...
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!