duanao6704 2014-04-11 08:45
浏览 88

将target =“_ blank”插入链接。

I would like to insert a target_blank into this button but I don't know how.

I tried inserting it into the href brackets but it came out with errors and my knowledge of php is very low.

Much appreciated if anyone could help me out here. (I would like to insert it in the 'orginal form' part rather than the 'pop up form').

<?php
                    $pricing = $subscription->get_pricingarray();

                    if($pricing) {
                        ?>
                        <span class='link'>
                            <?php

                                if(isset($M_options['formtype']) && $M_options['formtype'] == 'new') {
                                    // pop up form
                                    $link = admin_url( 'admin-ajax.php' );
                                    $link .= '?action=buynow&amp;subscription=' . (int) $sub->id;
                                    $class = 'popover';
                                } else {
                                    // original form
                                    $link = '?action=registeruser&amp;subscription=' . (int) $sub->id;


                                    $class = '';
                                }

                                if(empty($linktext)) {
                                    $linktext = apply_filters('membership_subscription_signup_text', __('Complete Registration', 'membership'));
                                }

                                $html = "<a href='" . $link . "' class='button " . $class . " " . apply_filters('membership_subscription_button_color', 'blue') . "'>" . $linktext . " </a>";
                                echo $html;
                            ?>
  • 写回答

1条回答 默认 最新

  • dqstti8945 2014-04-11 08:46
    关注

    You need to escape the quotes with a backslash, like so:

    $html = "<a href='" . $link . "' target=\"_blank\" class='button " . $class . " " . apply_filters('membership_subscription_button_color', 'blue') . "'>" . $linktext . " </a>";
    
    评论

报告相同问题?

悬赏问题

  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?