gpt4 book ai didi

php - 如何在html文本区域中逐句获取字符串

转载 作者:行者123 更新时间:2023-11-28 20:53:06 25 4
gpt4 key购买 nike

我有一个文本区域,其中包含以下信息,

Secured places in the national squad respectively
Selected to the national team this year as well
Selected to the national team twice during his university career
Went to school at ABS

当用户单击提交按钮时,我想将每行中的字符串获取到提交页面中的 php 变量,如下所示

$a = "Secured places in the national squad respectively";
$b = "Selected to the national team this year as well";
$c = "Selected to the national team twice during his university career";
$d = "Went to school at ABS";

谁能告诉我该怎么做?

最佳答案

如果您不关心句子而是换行符,那么您应该能够基于它来分成数组,如下所示:

$posted_text = $_POST['text']; // or however you get the value into a string
$text_array = explode(PHP_EOL, $posted_text);

关于php - 如何在html文本区域中逐句获取字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12063024/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com