extract
获取和关联数组,并将其分解为反映数组键名称的变量。$atts[\'height\']
只会是$height
, 换句话说。
代码的相关两行将变成:
<param name="type" value="video/quicktime" height="\'.$height.\'" width="\'.$width.\'">
<embed src="\'.$url.\'" height="\'.$height.\'" width="\'.$width.\'" autoplay="false" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/">
如果仍要使用索引,请确保用引号括住阵列键:
$atts[\'height\']
不是$atts[高度]。代替
extract
:
$atts = shortcode_atts( array(
\'url\' => \'#\',
\'width\' => \'480\',
\'height\' => \'320\'
), $atts )