PHP 4

[ PHP ]

(!!! Teleportom!!!)
: fopen, msql_num_fields, socket_write ...


50. PHP

PHP- .

1. PHP-, . , POST ?
2. (') backslash' . ?
3. , :
function myfunc($argument)
{
    echo $argument + 10;
}
$variable = 10;
echo "myfunc($variable) = " . myfunc($variable);
?
4. , newline?
<pre>
<?php echo "This should be the first line."; ?>
<?php echo "This should show up after the new line above."; ?>
</pre>
5. '!: Cannot send session cookie - headers already sent...' 'Cannot add header information - headers already sent...'.
6. /header . ?
7. IIS, 'No Input file specified'.
8. PHP- IE Lynx, Netscape . "View Source", IE, Netscape.
9. XML PHP? <?xml>!
10. PHP FrontPage HTML-, ?
11. , PHP?
12. CGI ( $DOCUMENT_ROOT $HTTP_REFERER) , . ?

1. PHP-, . , POST ?

, track_vars php.ini. PHP 4.0.3, on/. track_vars on, , : $_POST ( $HTTP_POST_VARS PHP- 4.1.0). , POST, - :
foreach ($_POST as $var => $value) {
    echo "$var = $value<br>\n";
}

2. (') backslash' . ?

addslashes(). , . magic_quotes_gpc php.ini.

3. , :
function myfunc($argument)
{
    echo $argument + 10;
}
$variable = 10;
echo "myfunc($variable) = " . myfunc($variable);
?

( ), return\ , echo() .

4. , newline?
<pre>
<?php echo "This should be the first line."; ?>
<?php echo "This should show up after the new line above."; ?>
</pre>

PHP "?>" "?>\n" ( \n newline/ ). , , echo- , PHP newline . , newline PHP, .

PHP ? HTML , newline , - , .

5. '!: Cannot send session cookie - headers already sent...' 'Cannot add header information - headers already sent...'.

header(), setcookie() /headers . . , .

6. /header . ?

getallheaders() , PHP Apache-. , /headers :
$headers = getallheaders();
foreach ($headers as $name => $content) {
    echo "headers[$name] = $content<br>\n";
}

7. IIS, 'No Input file specified'.

IIS . , CGI-, IIS. HTML- ( PHP) . META PHP- PHP-. PHP ́ . ISAPI . NT web-. . http://support.microsoft.com/support/kb/articles/q160/4/22.asp.

8. PHP- IE Lynx, Netscape . "View Source", IE, Netscape.

Netscape html- ( table), IE. html- html validator, validator.w3.org. , - </table>.

IE Lynx NUL' (\0) HTML, Netscape - . - PHP ( CGI-) . *nix - od -c \0. Windows, , . Netscape NUL , , IE Lynx - .

9. XML PHP? <?xml>!

/short tags, short_tags 0 php.ini, Apache. <File>, .

10. PHP FrontPage HTML-, ?

ASP- PHP. <% %> ASP. HTML- ( ). ASP, asp_tags php.ini Apache.

11. , PHP?

<?php phpinfo(); ?> .   PHP, , , web-. PHP, .

12. CGI ( $DOCUMENT_ROOT $HTTP_REFERER) , .
?

, ( "global $DOCUMENT_ROOT;", ) (.. "$GLOBALS["DOCUMENT_ROOT"]".


PHP HTML

: 3119 .

: - |  -