wotpress插件的非法字符串偏移问题

时间:2018-03-20 13:26:30

标签: php wordpress

我在使用wordpress插件时遇到问题,每当我尝试保存配置时,它都会保存,但没有保存任何内容。

[05-Mar-2018 07:40:55 UTC] PHP Warning:  Illegal string offset 'show_photos' in /mnt/web217/a0/48/51614848/htdocs/WordPress_03/wp-content/plugins/team-rosters/includes/mstw-tr-settings.php on line 283

这是debug.log

$output[$key] = ( sanitize_text_field( $input[$key] ) == $input[$key] ) ? $input[$key] : $output[$key];

这是第283行,任何想法如何解决这个问题或导致问题的原因是什么?

@fonini

  

数组([show_photos] => 1 [photo_label] =>照片[show_number] => 1   [number_label] => Nbr [name_label] =>姓名[show_position] => 1   [position_label] => Pos [show_height] => 1 [height_label] => H T   [show_weight] => 1 [weight_label] => Wt [show_year] => 0 [year_label]   =>年[show_experience] => 0 [experience_label] => Exp [show_age] => 0 [age_label] =>年龄[show_home_town] => 0 [home_town_label] =>家   镇[show_last_school] => 0 [last_school_label] =>上学   [show_country] => 0 [country_label] =>国家[show_bats_throws] => 0   [bats_throws_label] => Bat / Thw [show_other_info] => 0   [other_info_label] =>其他)

这是我从printr $ input

获得的结果

$ output is

  

0

1 个答案:

答案 0 :(得分:-1)

在调试三元表达式时,将它们分成不同的行总是有帮助的,这样PHP就可以更精确地引导您进入有问题的代码:

尝试:

@Resource private ManagedExecutorService managedExecutorService;

调试完问题后,您可以将其更改为单行。