目标是在每个句子前插入if($_SERVER['REQUEST_METHOD']=='GET'){
$id = $_GET['id'];
$sql = "SELECT * FROM user WHERE id='".$id."'";
$r = mysqli_query($con,$sql);
$res = mysqli_fetch_array($r);
$result = array();
array_push($result,array(
"id"=>$GET['id'],
"name"=>$res['name'],
"username"=>$res['username'],
"email"=>$res['email'],
"age"=>$res['age'],
"password"=>$res['password']
)
);
echo json_encode(array("result"=>$result));
mysqli_close($con);
}
。例如:
<br>
我想要的是:
df=(info="this text doesn't mean anything and it's only here as a demonstration. You can replace this with anything else and I want to somehow wrap this text")
这是我最好的尝试但不知何故它不起作用:
"this text doesn't mean anything and it's only here as a demonstration." "<br>" "You can replace this with anything else and I want to somehow wrap this text"
答案 0 :(得分:2)
如果点是指定句子的内容,则可以使用gsub
:
gsub('\\.', '. <br>', df)
哪会回来:
[1] "this text doesn't mean anything and it's only here as a demonstration. <br> You can replace this with anything else and I want to somehow wrap this text"
答案 1 :(得分:1)
您尝试不起作用的原因是strsplit
正在返回一个列表,而您希望使用[[1]]
粘贴该列表的第一个元素...然后使用{{1 }}
". <br>"