PHP不要写口音

发布于 2025-02-10 03:37:29 字数 346 浏览 1 评论 0原文

我的代码生成了一条消息,我使用file_get_contents获取它们。但是,此消息最终可以用某种语言具有重音,例如Á,â,ç

。好的,这不会引起一些问题。

但是,例如,WhatsApp不会阅读& cedil,此消息将被截断。

我如何更改诸如$ ccedil之类的代码;对于PHP变量,源是快速的?


$fim = file_get_contents($pedidoaux);

header("Location: http://api.whatsapp.com/send?1=pt_BR&phone=WHATSAPPNUMBER&text=$fim");

My code generates a message that I get them with file_get_contents. However, this message can be, eventually, have accents in some words, like á, ã, ç...

The PHP change this accented characters to special characters, like a ç. Ok, this not cause some problem.

However, the whatsapp dont read ¸, for example and this message will be truncate.

How I change the codes like $ccedil; for ç in a PHP variable on by fast way?


$fim = file_get_contents($pedidoaux);

header("Location: http://api.whatsapp.com/send?1=pt_BR&phone=WHATSAPPNUMBER&text=$fim");

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

埋葬我深情 2025-02-17 03:37:29

URL只能包含ASCII字符。对于其他任何内容,您需要编码它们。使用urlencode()

header("Location: http://api.whatsapp.com/send?1=pt_BR&phone=WHATSAPPNUMBER&text=" . urlencode($fim));

URLs can only contain ASCII characters. For anything else, you need to encode them. Use urlencode().

header("Location: http://api.whatsapp.com/send?1=pt_BR&phone=WHATSAPPNUMBER&text=" . urlencode($fim));
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文