微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

用.htaccess重写URL到PHP路由器

如何解决用.htaccess重写URL到PHP路由器

我正在尝试实现两级URL结构,利用该结构我可以操纵index.PHP路由器文件中的内容。它无法与下面的代码配合使用。当访问site.com/one时,$ page变量(GET)需要返回“一个”,并且如果我访问site.com/one/edit,则$ page变量仍应为“ one”,并带有附加变量$ action,这将成为“编辑”。

if($is_confirmed!==1){
            $receiver          =   get_userdata($user_id);
            $receiver_email    =   $receiver->user_email;
            $receiver_login    =   $receiver->user_login;
            $from               =   $current_user->user_login;
            $to                 =   $user_id;
            $subject            =   esc_html__( 'New Invoice','wprentals');
            $description        =   esc_html__( 'A new invoice was generated for your booking request','wprentals');

            wpestate_add_to_inBox($userID,$userID,$to,$subject,$description,1);
            wpestate_send_booking_email('newinvoice',$receiver_email);
        }else{
            //direct confirmation emails
            $user_email         =   $current_user->user_email;
            
            $receiver          =   get_userdata($user_id);
            $receiver_email    =   $receiver->user_email;
            $receiver_login    =   $receiver->user_login;
            
            
            //$receiver_id    =   wpsestate_get_author($booking_id);
           
            $receiver_email =   get_the_author_Meta('user_email',$user_id); 
            $receiver_name  =   get_the_author_Meta('user_login',$user_id); 
            wpestate_send_booking_email("bookingconfirmeduser",$receiver_email);// for user
            wpestate_send_booking_email("bookingconfirmed_nodeposit",$user_email);// for owner
            // add messages to inBox

            $subject=esc_html__( 'Booking Confirmation','wprentals');
            $description=esc_html__( 'A booking was confirmed','wprentals');
            wpestate_add_to_inBox($userID,$receiver_name,$description);

            $subject=esc_html__( 'Booking Confirmed','wprentals');
            wpestate_add_to_inBox($receiver_id,$username,$receiver_id,$description);

        }
    

如果我访问site.com/one/edit,上面的代码将$ page变量返回为“ one / edit”。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。