【问题标题】:php's echo 'n' space in href link [closed]php在href链接中的回声'n'空间[关闭]
【发布时间】:2021-03-06 12:06:34
【问题描述】:

我在 WhatsApp 分享链接中使用了 PHP 的回显字符串,但是当我在 WhatsApp 上分享它时,标题空间将尾随字符分开。帮帮我。

<a class="footerbtn" href="whatsapp://send?text= *Surinder Muni* Early To Bed & Early To Rise* %0Amysite.com/?n=Good Morning">
<?php
      echo $GET['n']
?>

【问题讨论】:

  • 欢迎来到 SO!在我们编码之前,我们首先需要学习如何格式化我们的代码:)。在剩下的帮助你之前,让我们正确地格式化代码。

标签: php html url


【解决方案1】:

在 WhatsApp 中创建链接时,您需要对空格(和其他潜在的无效字符)进行编码

echo urlencode('Good morning');

在 PHP 中用于读取 $_GET['n'] 的值将是

echo urldecode($_GET['n']);

【讨论】:

    猜你喜欢
    • 2013-03-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多