PHP GET error $


PHP GET error $

我想从 http://mywebsite1.com/register.php?log=firstname=Yoga&lastname=Galih 收集信息

但我想使用 PHP $_GET 将该信息发送到我的第二个网站并将其保存到reg.log

<?php
$txt = "reg.log"; 
if (isset($_GET["log"]) && isset($_GET["firstname"]) && isset($_GET["lastname"]) && isset($_GET["address"]) && isset($_GET["city"]) && isset($_GET["state"]) && isset($_GET["zip"]) && isset($_GET["country"]) && isset($_GET["phone"]) $$ isset($_GET["gender"]) && isset($_GET["haircolor"]) && isset($_GET["eyecolor"]) && isset($_GET["high"]) isset($_GET["weight"])) {
    $firstname = $_GET["fname"];
    $lastname = $_GET["lname"];
    $address = $_GET["address"];
    $city = $_GET["city"];
    $state = $_GET["state"];
    $zip = $_GET["zip"];
    $country = $_GET["country"];
    $gender = $_GET["gender"];
    $haircolor = $_GET["hcolor"];
    $eyecolor = $_GET["ecolor"];
    $high = $_GET["high"];
    $weight = $_GET["weight"];
    $phone = $_GET["phone"];
    echo $firstname .PHP_EOL. $lastname .PHP_EOL. $address .PHP_EOL. $city .PHP_EOL. $state .PHP_EOL. $zip .PHP_EOL. $country .PHP_EOL. $phone .PHP_EOL. $hcolor .PHP_EOL. $ecolor .PHP_EOL. $high .PHP_EOL. weigh .PHP_EOL. gender;
    $fh = fopen($txt, 'a'); 
fwrite($fh,$txt); // Write information to the file
fclose($fh); // Close the fil
}
?>

但我收到错误 [21-Mar-2016 15:17:09 美国/New_York] PHP 解析错误:语法错误,第 3 行/home/my2ndweb/public_html/include/register.php 中意外的"$"

我需要帮助

谢谢

哇,

有问题的行很长。我不是一个坚持 80 个字符的人,但这不可读。

问题出在第 3 行,您有$$而不是&&.您还错过了行尾附近的另一个&&

在第

3 行:

    $$ isset($_GET["gender"])

应该是:

    && isset($_GET["gender"])

最后也应该是

    && isset($_GET["weight"])

看起来您的 echo 也会遇到问题,因为您正在调用不存在的变量,即应该$ecolor$eyecolor因为这是您的变量名称

第 3 行的"$$ isset($_GET["gender"])"应该在第 3 行"&&isset($_GET["gender"])"

您需要将双 $$ 替换为 && isset($_GET["性别"]),并且您忘记了 isset($_GET["weight")之前的 &&]