【问题标题】:Email encode in text input using [duplicate]使用[重复]在文本输入中进行电子邮件编码
【发布时间】:2013-02-13 08:49:34
【问题描述】:

我想在文本框中编码一个电子邮件 ID。电子邮件 ID 保存在数据库中。当页面加载时,我使用 php 从数据库中检索电子邮件 ID 并显示在文本输入中,当我在页面源中看到电子邮件 ID 时,应该对电子邮件 ID 进行编码。如何使用 php 和 html 做到这一点?

【问题讨论】:

  • “编码”是什么意思?请详细说明。

标签: php html email encoding character-encoding


【解决方案1】:

试试这个:

function encode_email($e) {
  $output = '';
  for ($i = 0; $i < strlen($e); $i++) { $output .= '&#'.ord($e[$i]).';'; }
  return $output;
}

 echo(encode_email('email@in.com'));

【讨论】:

  • 它会抛出一个通知,因为$output 之前没有启动。
  • 感谢您的回复。我只尝试过相同的编码方法。但在页面源中,文本输入显示为
猜你喜欢
  • 2019-02-01
  • 2010-09-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-01-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多