如何使用pregex在PHP中复制文本 [英] How to get copied text in PHP using pregex
本文介绍了如何使用pregex在PHP中复制文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
hai,
我需要在变量中复制文本。我可以复制文本,如msexcel,notepad等...并想要分配复制文本到php变量然后我使用preg_split分割一个值。但是我不能将复制的文本变成变量
请帮帮我。
我尝试过:
<?php
$ str =567567 thangavelchild Pending sdfs dfsdf
$ keywords = preg_split(/ [\ n] + /,$ str);
$ ro = array_values($ keywords);
foreach($ ro as $ tt)
{
?>
< tr>
<?php
$ keyword = preg_split(/ [\ t] + /,$ tt);
?>
< td><?php print_r($ keyword [0]); ?>< / TD>
< td><?php print_r($ keyword [1]); ?>< / TD>
< td><?php print_r($ keyword [2]); ?>< / TD>
< td><?php print_r($ keyword [3]); ?>< / TD>
< td><?php print_r($ keyword [4]); ?>< / TD>
<?php
?>
< / tr>
<?php
}
?>
解决方案
str = 567567 thangavelchild Pending sdfs dfsdf
keywords = preg_split(/ [\ n] + /,
str);
hai,
I need to get copied text in variable.I can copy text from like msexcel,notepad,etc...and want to assign a copied text to php variable then i split a value using preg_split.but i can't to get copied text into variable
please help me.
What I have tried:
<?php $str="567567 thangavelchild Pending sdfs dfsdf" $keywords = preg_split("/[\n]+/", $str); $ro=array_values($keywords); foreach ($ro as $tt) { ?> <tr> <?php $keyword = preg_split("/[\t]+/", $tt); ?> <td><?php print_r ($keyword[0]); ?></td> <td><?php print_r ($keyword[1]); ?></td> <td><?php print_r ($keyword[2]); ?></td> <td><?php print_r ($keyword[3]); ?></td> <td><?php print_r ($keyword[4]); ?></td> <?php ?> </tr> <?php } ?>
解决方案
str="567567 thangavelchild Pending sdfs dfsdf"
keywords = preg_split("/[\n]+/",
str);
这篇关于如何使用pregex在PHP中复制文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文