Faker在不结束的情况下获取文字的情况如何?

发布于 2025-01-28 19:04:26 字数 241 浏览 4 评论 0原文

在Laravel 9应用程序中,我用Faker设置了文本字段的值:

 $this->faker->unique()->text(25);

我看到字段以“。”结尾。 我如何在不结束“”而获得文字。 ?

"laravel/framework": "^9.11",
"fakerphp/faker": "^1.9.1",

谢谢。

When in laravel 9 app I set value for text field with faker :

 $this->faker->unique()->text(25);

I see text for field ending with “.”.
How can I get text without ending “.” ?

"laravel/framework": "^9.11",
"fakerphp/faker": "^1.9.1",

Thanks.

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

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

发布评论

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

评论(1

梦里人 2025-02-04 19:04:28

图书馆的作者决定不实施此功能: https://github.com/fzanininotto/ Faker/essument/1128

您可以做到这样做:

substr(str_replace('.', '', $this->faker->unique()->text(25)), 0, 25);

如果您需要完全有25个字符,则可以将其调整为特定符号。

The author of the library decided not to implement this feature: https://github.com/fzaninotto/Faker/issues/1128

You can do it like:

substr(str_replace('.', '', $this->faker->unique()->text(25)), 0, 25);

You can adjust this to replace with specific symbol, if you need to have exactly 25 chars.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文