重写.htaccess后POST不工作

编程入门 行业动态 更新时间:2024-10-15 20:20:56
本文介绍了重写.htaccess后POST不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在向.htaccess添加重写后,我的表单无效。我发现很多主题都有类似的问题,但都没有解决我的问题。如果你能看看,我将不胜感激。它是:

RewriteEngine On RewriteBase / RewriteCond%{THE_REQUEST} ^ [AZ] { 3,} \ s([^。] +)\.php [NC] RewriteRule ^%1 [R = 301,L] RewriteCond%{REQUEST_FILENAME}!-d RewriteCond%{REQUEST_FILENAME} .php -f RewriteRule ^(。*?)/?$ $ 1.php [NC,L]

这是我的邮政编码:)

<?php 函数send_email($ to_email,$ from_email,$ from_name,$ subject,$ msg, $ showinfo){ //拆分为电子邮件数组,如果给定 if(is_array) ($ to_email)){ $ to_email_string = implode(',',$ to_email); } else { $ to_email_string = $ to_email; } //构建内容 $ message ='< html>< body>'; $ message。='< table rules =allstyle =border-color:#666; cellpadding =10>'; $ message。=< tr style ='background:#eee;'>< td> Imie i nazwisko: < / td>< td> ; 。 strip_tags($ from_name)。 < / TD>< / TR> 中; $ message。=< tr>< td> 电子邮件:< / td>< td> 。 strip_tags( $ from_email)。 < / TD>< / TR> 中; $ message。=< tr>< td> Temat:< / td>< td> 。 strip_tags( $ subject)。 < / TD>< / TR> 中; $ message。=< tr>< td> Wiadomość:< / td>< td> 。 nl2br( strip_tags($ msg))。 < / TD>< / TR> 中; $ message。=< / table>; $ message。=< / body>< / html>; //汇编标题 $ headers ='MIME-Version:1.0'。 \r\\\; $ headers。='Content-type:text / html; charset = iso-8859-1'。 \r\\\; $ headers。=From:$ from_name< $ from_email> 。 \r\\\; //通过PHP的mail()函数发送 if($ showinfo) { mail($ to_email_string,$ subject,$ message,$ headers)或死(json_encode( array('error'=> true,'msg'=>'Felnärduskickar meddelanden。'))); echo json_encode(array('error'=> false,'msg'=>Ditt meddelande har skickats。)); } else { mail($ to_email_string,$ subject,$ message,$ headers); } } if(isset($ _POST ['name'])&& isset($ _POST ['email'])&& isset( $ _POST ['subject'])&& isset($ _POST ['message'])&& $ _POST ['其他'] =='') { send_email(myemail,$ _POST ['email'],$ _POST ['name'], $ _POST [ 'subject',$ _POST ['message'],true); send_email($ _POST ['email'],'myemail',LHI,'复制:'。 $ _POST ['subject'],$ _POST ['message'],false); } if(isset($ _POST ['info'])&& $ _POST ['info'] =='notajax') { header(HTTP / 1.1 301永久移动); header(Location:http:// localhost / dash /); }

提前感谢您的帮助。

解决方案

1.php [NC,L]

,这是我的邮政编码:)

<?php function send_email(

to_email,

My forms not working after adding rewrite to .htaccess. I found many topics with similar problem but neither have solution to my issue. I would be grateful if you could take a look. There it is:

RewriteEngine On RewriteBase / RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC] RewriteRule ^ %1 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*?)/?$ $1.php [NC,L]

and here is my post code:)

<?php function send_email ($to_email, $from_email, $from_name, $subject, $msg, $showinfo) { //split up to email array, if given if (is_array($to_email)) { $to_email_string = implode(', ', $to_email); } else { $to_email_string = $to_email; } // build content $message = '<html><body>'; $message .= '<table rules="all" style="border-color: #666;" cellpadding="10">'; $message .= "<tr style='background: #eee;'><td>Imie i nazwisko: </td><td>" . strip_tags( $from_name ) . "</td></tr>"; $message .= "<tr><td>E-mail: </td><td>" . strip_tags( $from_email ) . "</td></tr>"; $message .= "<tr><td>Temat: </td><td>" . strip_tags( $subject ) . "</td></tr>"; $message .= "<tr><td>Wiadomość: </td><td>" . nl2br( strip_tags( $msg ) ) . "</td></tr>"; $message .= "</table>"; $message .= "</body></html>"; //Assemble headers $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= "From: $from_name <$from_email>" . "\r\n"; //send via PHP's mail() function if( $showinfo ) { mail($to_email_string, $subject, $message, $headers) or die(json_encode( array( 'error' => true, 'msg' => 'Fel när du skickar meddelanden.'))); echo json_encode( array( 'error' => false, 'msg' => "Ditt meddelande har skickats.")); } else { mail($to_email_string, $subject, $message, $headers); } } if( isset( $_POST['name']) && isset( $_POST['email']) && isset( $_POST['subject']) && isset( $_POST['message']) && $_POST['other'] == '') { send_email( "myemail", $_POST['email'], $_POST['name'], $_POST['subject'], $_POST['message'], true ); send_email( $_POST['email'], 'myemail', "LHI", 'Copy: ' . $_POST['subject'], $_POST['message'], false ); } if( isset( $_POST['info']) && $_POST['info'] == 'notajax' ) { header("HTTP/1.1 301 Moved Permanently"); header("Location: localhost/dash/"); }

Thanks in advance for any help.

解决方案

1.php [NC,L]

and here is my post code:)

<?php function send_email (

to_email,

更多推荐

重写.htaccess后POST不工作

本文发布于:2023-10-11 14:11:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1481931.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重写   工作   htaccess   POST

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!