technology to switch html to php in a website
after some days learning html and css i have got used to programming in html, my skills are improving and i could program a site with css which looks very good... now my next step is to learn using a current technology for web2.0 like php
all my pages end in html extension but i want to change them to php extension so the site will be more current and work with better technology.
i have read many manuals but i cannot find how to switch my work from htm开发者_StackOverflow社区l into php technology link to the work http://preferredmerchantservices.net/ thanks
PHP is a programming language. HTML and CSS are markup languages. You don't convert HTML to PHP. PHP can be used to generate HTML, like it can be used to generate many other formats.
Changing your file extensions from *.html to *.php is not going to magically make your "current." Also, another thing to consider is that many programmers will name their PHP documents differently based on the content contained within them. For example, any files I write that contain nothing but PHP and don't directly output to the browser, I will use the *.php extension. However, if a script contains a mixture of PHP and HTML, I will use the *.phtml extension. This behavior is not "standardized," and the PHP parser will treat both files exactly the same (barring your server is configured to recognize both as PHP files). It's more of a personal preference of the developer.
Really, what you should do is check out the PHP manual, get an introduction to PHP book, or do a few Google searches on getting started with PHP.
Just switch the ending of your files to .php
- now you have a php program, although a very boring one that just outputs static HTML.
Go anywhere inside that HTML and insert:
<?php
echo 'This is php, which is ' . (6*7) . ' times cooler than HTML!';
?>
Now, reload the page and watch the output php generated.
One more thing: For php code to be executed on the server, you need a server in the first place. If your current URLs start with file://
, you'll need to install a webserver(for example apache) with php and let your URLs start with http://localhost/
. You can find more about how to configure php (and your webserver) in the php manual.
精彩评论