Home > Backend Development > PHP Tutorial > 求一取SQL语句SELECT … FROM中字段名列表的正则解决思路

求一取SQL语句SELECT … FROM中字段名列表的正则解决思路

WBOY
Release: 2016-06-13 10:10:18
Original
927 people have browsed it

求一取SQL语句SELECT …… FROM中字段名列表的正则
如题

------解决方案--------------------

PHP code
<?php $str="select ziduan1,ziduan2,ziduan3 from";preg_match("/select\s+(.*)\s*from/",$str,$matchs);$arr = explode(",",trim($matchs[1]));print_r($arr);//Array ( [0] => ziduan1 [1] => ziduan2 [2] => ziduan3 ) ?><div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template