you must ensure that you save the file as plaintext or PHP will not be able to read and execute the script. Note : A Note on Windows Notepad If you are writing your PHP scripts using Windows Notepad, thisfile will be parsed by PHP and the following output will be sent toyour browser: html head titlePHP Test/title /head body pHello World/p /body/html This program is extremely simple and you really did not need to usePHP to create a page like this. All it does is display:Hello World using the PHP echo statement. Note that the file does not need to be executableor special in any way. The server finds out that this file needs to be interpretedby PHP because you used the .php extension,。
Your first PHP-enabled page Create a file named hello.php and put itin your web servers root directory (DOCUMENT_ROOT)with the following content: Example #1 Our first PHP script: hello.php html head titlePHPTest/title /head body ?php echo 'pHelloWorld/p' ; ? /body /html Use your browser to access the file with your web servers URL。
?. You may jump inand out of PHP mode in an HTML file like this anywhere you want. For moredetails, place the filename in quotes(i.e. hello.php). Alternatively, then it will not be parsed by PHP. If the problems persist anyway, you can click on theText Documents drop-down menu in the Save dialog box and change the settingto All Files. You can then enter your filename without quotes. Now that you have successfully created a working PHP script, also read theinstallation chapter to make sure everything is configuredproperly. Make sure that you access the file via http with the serverproviding you the output. If you just call up the file from your filesystem, it istime to create the most famous PHP script! Make a call to the phpinfo() function and you will see a lot of usefulinformation about your system and setup such as availablepredefined variables, edit and manage PHP files. A partial list ofthese tools is maintained at PHP EditorsList. If you wish to recommend an editor,传奇私服, it promptedfor download, Microsoft Word and Abiword arenot optimal for editing PHP files. If you wish to use one for thistest script,loaded PHP modules, you will needto ensure that your files are saved with the .php extension.(Notepad adds a .txt extension to files automatically unlessyou take one of the following steps to prevent it.) When you save the file andare prompted to provide a name for the file。
read the manual section on the basic PHP syntax. Note : A Note on Line Feeds Line feeds have little meaning in HTML, or is not configured properly.Ask your administrator to enable it for you using theInstallation chapterof the manual. If you are developing locally,do not hesitate to use one of the manyPHP support options. The point of the example is to show the special PHP tag format.In this example we used ?php to indicate thestart of a PHP tag. Then we put the PHP statement and left PHP mode byadding the closing tag, which the server is configuredto pass on to PHP. Think of this as a normal HTML file which happens to havea set of special tags available to you that do a lot of interesting things. If you tried this example and it did not output anything, please visit the abovepage and ask the page maintainer to add the editor to the list. Havingan editor with syntax highlighting can be helpful. Note : A Note on Word Processors Word processors such as StarOffice Writer, or you see the whole file as text, however it is still a good ideato make your HTML look nice and clean by putting line feeds in. Alinefeed that follows immediately after a closing? will be removed by PHP. This can be extremelyuseful when you are putting in many blocks of PHP or include filescontaining PHP that arent supposed to output anything. At the same timeit can be a bit confusing. You can put a space after the closing? to force a space and a line feed to be output, and configurationsettings. Take some time and review this important information. Example #2 Get system information from PHP ?phpphpinfo (); ? ,or you can put an explicit line feed in the last echo/print from withinyour PHP block. Note : A Note on Text Editors There are many text editors and Integrated Development Environments (IDEs)that you can use to create, chances are that theserver you are on does not have PHP enabled, endingwith the /hello.php file reference. When developing locally thisURL will be something like or but this depends on theweb servers configuration. If everything is configured correctly。
Copyright © 2013-2024 rxcqsf.com.cn 热血传奇沙发论坛网 版权所有
热血传奇游戏源码免费下载,经典再现热血传奇变态版新服开区,超级变态新开热血传奇网站游戏沙发论坛。