繁体   English   中英

如何使用“|”字符将Textarea中的值插入数据库?

[英]How To Insert Value From Textarea To Database With “|” Characters?

我的表tapphimtap列, 链接列和播放器
我想在“|”之前插入数据 并在“|”之后 在不同的列上,例如我将此值输入到textarea:

1|fuuka-vietsub|https://drive.google.com/file/d/1tDKPbZ_gaNZrcYHt-tQtcF-TH0hMzGFi/view?usp=sharing

1插入列点击fuuka-vietsub插入列链接https://drive.google.com/file/d/1tDKPbZ_gaNZrcYHt-tQtcF-TH0hMzGFi/view?usp=sharing to column player
我有来自index.php的代码:

<form action="api.php" method="post">
<textarea name="themphim" id="themphim"></textarea>
<input type="submit" name="save" value="save"></input>
</form>

文件api.php:

<?php
include("db_connect.php");

if(isset($_POST['save']))
{
// Please give for me code
... 
//
}
?>


谢谢大家 !

您可以使用explode来分解使用分隔符

$string = '1|fuuka-vietsub|https://drive.google.com/file/d/1tDKPbZ_gaNZrcYHt-tQtcF-TH0hMzGFi/view?usp=sharing';
$strToArray = explode('|',$string);
echo '<pre>';
print_r($strToArray);

产量

Array
(
 [0] => 1
 [1] => fuuka-vietsub
 [2] => https://drive.google.com/file/d/1tDKPbZ_gaNZrcYHt-tQtcF-TH0hMzGFi/view?usp=sharing
)

现在你可以使用数组键0 -> tap1 -> link2 -> player

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM