当我从xsl表中获取数据时,会形成下面的数组 我使用了empty(),isset(),is_null但都没有工作
贝洛是我的代码
<pre/>Array
(
[0] => Array
(
[0] => quetion
[1] => option1
[2] => option2
)
[1] => Array
(
[0] => What
[1] => a
[2] => b
)
[2] => Array
(
[0] => now
[1] => a
[2] => b
)
[3] => Array
(
[0] => What
[1] => a
[2] => b
)
[4] => Array
(
[0] =>
[1] =>
[2] =>
)
[5] => Array
(
[0] =>
[1] =>
[2] =>
)
[6] => Array
(
[0] =>
[1] =>
[2] =>
)
[7] => Array
(
[0] =>
[1] =>
[2] =>
)
[8] => Array
(
[0] =>
[1] =>
[2] =>
)
[9] => Array
(
[0] =>
[1] =>
[2] =>
)
[10] => Array
(
[0] =>
[1] =>
[2] =>
)
)
)
这是我的输出:
Array (
[0] => Array
(
[0] => quetion
[1] => option1
[2] => option2
)
[1] => Array
(
[0] => What
[1] => a
[2] => b
)
[2] => Array
(
[0] => now
[1] => a
[2] => b
)
[3] => Array
(
[0] => What
[1] => a
[2] => b
)
我想要这种类型的数组
declare @tablename nvarchar(100)
declare c1 cursor for
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_CATALOG='tt' AND TABLE_TYPE='BASE TABLE'
open c1
fetch next from c1 into @tablename
while @@FETCH_STATUS = 0
begin
print @t1
exec('alter table ' + @tablename + ' nocheck constraint all')
exec('delete from ' + @tablename)
exec ('alter table ' + @tablename + ' check constraint all')
fetch next from c1 into @tablename
end
close c1
DEALLOCATE c1
答案 0 :(得分:0)
foreach ($newSheetData as $key => $value) {
$dataFiltred = array_filter($value, function($var) {
if ($var === 0 || $var === '0' || !empty($var)) {
return true;
}
return false;
});
if (empty($dataFiltred)) {
unset($newSheetData[$key]);
}
}