【问题标题】:Href link with php value带有 php 值的 Href 链接
【发布时间】:2011-02-05 05:47:53
【问题描述】:

我有一个类似下面的链接

        <a href="#" onclick="window.open('http://www.twitter.com/home?status=Reading+Facebook share, Yahoo Buzz and Tweet this buttons for Blogger blogs+http://www.didiknow.com');">Tweet this</a>

我想在里面插入一个 php 变量值作为状态的东西 喜欢

          <a href="#" onclick="window.open('http://www.twitter.com/home?status=$markme_ddesc');">Tweet this</a>

怎么办??请帮帮我..

【问题讨论】:

    标签: php href


    【解决方案1】:

    你可以在那里回显它吗?

    <?= $markme_ddesc ?>
    

    【讨论】:

      【解决方案2】:

      像这样使用

      <a href="#" onclick="window.open('http://www.twitter.com/home?status=<?=$markme_ddesc?>">Tweet this</a>
      
      note: status=<?=$markme_ddesc?>
      

      【讨论】:

        【解决方案3】:

        你有几种方法,例如:

        <a href="#" onclick="window.open('http://www.twitter.com/home?status=<?=$markme_ddesc?>">Tweet this</a>
        

        <a href="#" onclick="window.open('http://www.twitter.com/home?status=<?php print($markme_ddesc);?>">Tweet this</a>
        

        或者(如果你在标签内)

        print("<a href=\"#\" onclick=\"window.open('http://www.twitter.com/home?status=$markme_ddesc\">Tweet this</a>");
        

        【讨论】:

        • 你能说说他们是怎么不工作的吗?您是否定义了 $markme_ddesc 变量并且实际上有一个工作的 php 脚本?
        • 解析错误:语法错误,第 114 行 /home1/tc/public_html/td/plugins/content/bookmarker.php 中的意外 T_STRING
        • 而且我认为你没有给出 ) 和关闭引号它不会起作用..我在那里有 PHP 变量..
        • 两者都适用于我的测试。确保 标签中没有示例!
        猜你喜欢
        • 2012-03-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-11-14
        • 2020-04-26
        • 2017-01-06
        相关资源
        最近更新 更多