看起来好像我的一切都好,但我不知道为什么它会给我这样的错误:请帮帮我
解析错误:语法错误,意外'['in /home/sites/xyz.com/public_html/wp-content/themes/abc/single-products.php 在第330行
=============
解析错误:语法错误,意外'['in /home/sites/xyz.com/public_html/wp-content/themes/abc/single-products.php 在第331行
这是我的代码:
<?php
$exclude = ['diffusion','twice-loved','antique-vintage'];
$tax_slugs = [];
foreach ($tax as $value) {
array_push($tax_slugs, $value->slug);
}
$intersect = count(array_intersect($exclude, $tax_slugs));
//if( $tax[0]->slug != 'diffusion'):
if($intersect === 0):
?>
答案 0 :(得分:0)
PHP数组:http://php.net/manual/en/language.types.array.php
$exclude = array('diffusion','twice-loved','antique-vintage');
$tax_slugs = array();
...