如何隐藏从数据库打印的文本
我现在有一些关于隐藏某些字符的问题...我想在帐户管理中隐藏用户名的前几个字符。这是我的问题: 在帐户管理上,我在表中有 $username ,该表是从数据库中获取的,我需要这个用户名不要像这样显示: 用户名=> **rname - 只需使用 php 或类似的网页代码将几个前几个字符替换为“”。
I have now some question about hiding some characters ... I want to hide first few characters fro user name on account management. Here is my problem:
On account management I have $username in table which is taken from DB an I need this username not to be displayed like this:
Username => **rname - just replace few first characters with "" using php or similar code for webpages.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我想您也不想让他们知道用户名中有多少个字符?使用 substr_replace()
输出:
**rname
当然,如果用户名较短,这将不起作用。你可以这样做
I assume you don't want to let them know how many characters are in the username, either? Use substr_replace()
Outputs:
**rname
Of course if a username is shorter this won't work. You could instead do
我不太确定你想说什么。你想实现这个目标吗?
I'm not really sure what you are trying to say. Do you want to achieve this?
你可以这样做;
You could do;
从字符串中删除前两个字符。
remove first two chars from the string.
你可以使用这样的东西
you could use something like this