ohmydengzi
10/12/2018 - 8:54 AM

改变字符串格式,用于mybatis新增操作

改变字符串格式,用于mybatis新增操作

<?php
//$string = "`cid`, `leadid`, `uid`, `assignuid`, `assigntime`, `creator`, `editor`, `lastuid`, `seaid`, `fullname`, `shortname`, `address`, `website`, `phone`, `email`, `zipcode`, `number`, `desc`, `contacts`, `opportunitys`, `events`, `snapshoots`, `latestevent`, `latesteventtime`, `createtime`, `updatetime`, `movetime`, `isunread`, `status`, `isdel`, `sort`";
$string = "";
$arrays = explode(",", $string);
$strings ="";
foreach($arrays as $item) {
    $inser = trim($item, ' `');
    $inseradd = "#{item." . $inser . "}";
    $strings = $strings . ", " . $inseradd;
}
echo( "(" . trim($strings, ',') . ")");


// 有回车的间隔,修改为逗号
<?php
$a = "14000152
240891383
20385004";
$key_arr = str_replace(PHP_EOL,',',$a);
var_dump($key_arr) ;
?>