可能只是我周末已经签出,但是在更新基于某个值的关联数组时遇到了一些麻烦。例如,这是我到目前为止所拥有的:
$slideshow_vars = array(
'js_animation' => $slideshow_options['js_animation'],
'js_slide_direction' => $slideshow_options['js_slide_direction'],
'js_slideshow' => $slideshow_options['js_slideshow'],
'js_slideshow_speed' => $slideshow_options['js_slideshow_speed'],
'js_animation_duration' => $slideshow_options['js_animation_duration'],
'js_direction_nav' => $slideshow_options['js_direction_nav'],
'js_control_nav' => $slideshow_options['js_control_nav'],
'js_keyboard_nav' => $slideshow_options['js_keyboard_nav'],
'js_mousewheel' => $slideshow_options['js_mousewheel'],
'js_prev_text' => $slideshow_options['js_prev_text'],
'js_next_text' => $slideshow_options['js_next_text'],
'js_pause_play' => $slideshow_options['js_pause_play'],
'js_pause_text' => $slideshow_options['js_pause_text'],
'js_play_text' => $slideshow_options['js_play_text'],
'js_randomize' => $slideshow_options['js_randomize'],
'js_slide_start' => $slideshow_options['js_slide_start'],
'js_animation_loop' => $slideshow_options['js_animation_loop'],
'js_pause_on_action' => $slideshow_options['js_pause_on_action'],
'js_pause_on_hover' => $slideshow_options['js_pause_on_hover'],
'js_controls_container' => $slideshow_options['js_controls_container'],
'js_manual_controls' => $slideshow_options['js_manual_controls'],
'js_start_function' => $slideshow_options['js_start_function'],
'js_before_function' => $slideshow_options['js_before_function'],
'js_after_function' => $slideshow_options['js_after_function'],
'js_end_function' => $slideshow_options['js_end_function']
);
foreach ($slideshow_vars as $key => $value) {
if($value == NULL) {
$value = "false";
}
}
print_r($slideshow_vars);
在数组中的许多值中,它们正在输出NULL
——好吧,我需要将它们更改为字符串false
(此数据正在本地化,然后发送到预期为 false 的 JS 文件)。当我执行上述操作时,print_r()
它实际上并没有更新任何内容。