dousuiguang9328 2011-09-08 16:35
浏览 23

使用php邮件功能时,在获取参数前面添加了Forward Slash

I have a link in the body of a message that's of the form

page.php?id=x&name=y

When i send the message using php's mail function

it outputs the link (in gmail if it matters) as page.php/?id=x&name=y i.e. it puts a forward slash in front of the get parameter "id". I will eventually do URL rewrites but I'm curious as to how to prevent this from happening in PHP without doing a URL rewrite?

Thanks

EDIT:

Here's the relevant section of code:

//     $send_email and $rec_email are grabbed from database

 $part_mess = "<b>$sender_name". " says hi</b><br/><a href=profile.php?id=$sender_id&uname=$sender> View $sender_name"."'s profile</a>" ;
 $mess = $part_mess."<br/> Via <a href = 'http://www.mysite.com'>My Site</a>";
 $headers =  "MIME-Version: 1.0" . "
"."Content-type:text/html;charset=iso-8859-1" . "
".'From:'. $send_email . "
";
 mail($rec_email, $subject,$mess,$headers , '-f admin@name.mysite.com');
  • 写回答

1条回答 默认 最新

  • dongyanggan3025 2011-09-20 04:34
    关注

    I was having the same problem, are you with 1and1.com for your hosting? For some reason only the website I had hosted with them was the mail() function escaping all special character's with forward slashes.

    Try this:

    //     $send_email and $rec_email are grabbed from database
    
     $part_mess = "<b>$sender_name". " says hi</b><br/><a href=profile.php?id=$sender_id&    uname=$sender> View $sender_name"."'s profile</a>" ;
     $mess = $part_mess."<br/> Via <a href = 'http://www.mysite.com'>My Site</a>";
     $headers =  "MIME-Version: 1.0" . "
    "."Content-type:text/html;charset=iso-8859-1" . "
    ".'From:'. $send_email . "
    ";
     mail($rec_email, $subject,stripslashes($mess),$headers , '-f admin@name.mysite.com');
    
    评论

报告相同问题?

悬赏问题

  • ¥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()实现黑框里写入与删除?