开发者

HTTP Error 500 when running php scripts

I am running a PHP page and as soon as I introduce calls like this: $_GET('') then everything goes wrong and I get an error 500.

This code goes not work:

    echo $_GET('u开发者_JS百科sername');
    echo $_GET('password');

?>

This code does:

<?php

    phpinfo();

?>


The above code has syntax errors - you need to use square brackets.

The web server's error logs will show you those errors if you have access to them.


Use this:

echo "Username: ".$_GET['username']."<br />Password: ".$_GET['password'];

Since $_GET is a array and not a function, you need to use [square brackets] instead of (normal brackets) to retrieve the data out of a array.


To figure out what the problem is you need to turn on php error reporting. You do this by running this the first thing you do in your php-file:

ini_set('display_errors',1);
error_reporting(E_ALL);

E_ALL means the interpreter will show you errors, warnings and notices. After that, everything will be pretty obvious since php will tell you what went wrong.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜