更正WordPress插件中的非法字符串偏移警告

时间:2014-01-23 20:25:37

标签: php wordpress

我收到此错误 “警告:第250行contact-me.php中的非法字符串偏移'宽度'

警告:第252行“contact-me.php”中的非法字符串偏移'title'

我意识到文件中的这部分代码是错误的,但是我还不熟悉PHP,我想知道是否有人可以帮我重新编写这一部分以消除错误。谢谢! (错误从第250行开始,以$ width开头,第252行以$ title开头)。

我尝试在其他线程上实现一些更正但是没有成功。感谢您的协助。

function shortcode_handler($_atts) {
    if ($this->check_settings() === true) {
        $width = intval($_atts["width"]);
        if ($width < 100 || $width > 1000) $width = "";
        $title = $_atts["title"];
        if (empty($title)) $title = htmlspecialchars($this->options['form_title'], ENT_QUOTES);
        $suffix = "_".rand(1000, 9999);
        $form = '

我解决了。 我使用了以下代码:

if (isset($_atts["width"]))
        $width = var_dump($_atts["width"]);           
  if (isset($_atts["title"])) 
        $title = var_dump($_atts["title"]);

1 个答案:

答案 0 :(得分:0)

我使用了以下代码:

if (isset($_atts["width"]))
    $width = var_dump($_atts["width"]);           
if (isset($_atts["title"])) 
    $title = var_dump($_atts["title"]);