Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用nano在php中输入url_Php_Url_Nano - Fatal编程技术网

如何使用nano在php中输入url

如何使用nano在php中输入url,php,url,nano,Php,Url,Nano,当我进入时: $site = "http://localhost"; 双正斜杠后的所有内容都被注释掉。我如何防止这种情况? 编辑谢谢你的帮助。我想我应该详细说明一下。我正在设置此变量,以便在此代码中使用它: if ($numrows == 1){ $site = "http://localhost"; $webmaster = "myemail@somemail.com"; //not m

当我进入时:

$site = "http://localhost";
双正斜杠后的所有内容都被注释掉。我如何防止这种情况? 编辑谢谢你的帮助。我想我应该详细说明一下。我正在设置此变量,以便在此代码中使用它:

 if ($numrows == 1){
                          $site = "http://localhost";
                          $webmaster = "myemail@somemail.com"; //not my email
                          $headers = "From: $webmaster";
                          $subject = "Activate Your Account";
                          $message = "Thank you for registering! Click the link below to activate your account.\n";
                          $message .= "$site/activate.php?user=$getuser&code=$code\n";
                          $message .= "You must activate your account to log in.";

                          if(mail($getemail, $subject, $message, $headers)){
                          $errormsg = "You have been registered.  You must activate your account from the activation link sent to <b>$getemail</b>.";
                          $getuser = "";
                          $getemail = "";
                          }else
                          $errormsg = "An error has occurred. Your activation email was not sent.";
                      }else
                       $errormsg = "An error has occurred. Your account was not created.";

我想问题可能是我的本地主机没有设置为发送电子邮件。如果页面实际位于web上,并且我为$site变量使用了一个真实的URL,这会起作用吗?

这应该会起作用,但输出会受到影响,因此这不是一个解决方案:

$site = "http:\/\/localhost";
然后您可以尝试:

$site = "http:"."/"."/"."localhost";
或者:

$site = "http:".chr(47).chr(47)."localhost";

据我所知,您希望使用$site变量作为页面内的链接,例如:

    <?php
    $site = "http://localhost";
    echo "<a href=\"$site\">sites</a>";
    ?>

就我的本地主机服务器而言,这里的代码行似乎没有任何问题。这可能是因为您没有正确地转义某些内容,例如在我的echo语句中,我必须反斜杠引用。

在PHP中,双引号表示应该处理文本

所以

将给出:1

但是如果你

echo '$v';
你会得到:$v

试着做:

$site = 'http://localhost';

nano可能需要有php意识。。。不知道怎么做。代码将在本地工作,也在生产中。Nano标识//作为注释,但仅用于显示目的。执行不受影响。Leggendario的问题不是PHP,因为nano编辑器在检测//字符时会将所有字符标记为注释。代码在PHP中是100%可执行的,但如果您不想看到nano注释,则需要一个技巧,比如隔离每个/并连接它们,或者用chr47表示。山姆会呆在这里看书,因为我不是真的做nano,作为一名编辑,sublime对我来说一直都很好。。。
$site = 'http://localhost';