我想從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
}
?>
,但我得到的錯誤[ 3月21日-2016 15時17分09秒美國/紐約] PHP解析錯誤:語法錯誤,意想不到的 '$' 在/home/my2ndweb/public_html/includes/register.php上線3
我需要幫助
謝謝
在isset之前忘了&&($ _ GET [「weight」] – frosty
將它們全部放在一個'isset'中。 http://php.net/manual/en/function.isset.php'如果提供了多個參數,則只有在設置了所有參數的情況下,isset()纔會返回TRUE。評估從左到右,遇到未設置的變量時立即停止。「# – chris85
**語法錯誤:**使用適當的IDE,如Netbeans或PHPStorm – CodeGodie