样式表获取错误为未定义变量[关闭]

样式表获取错误为未定义变量[关闭]

问题描述:

I got notify error like this:

NOTICE: wp-content/themes/aquasize/admin/library/engines/typography-engine.php:66 - Undefined variable: stylesheet

NOTICE: wp-content/themes/aquasize/admin/library/engines/typography-engine.php:70 - Undefined variable: stylesheet

Here my full code: http://pastebin.com/VsrHzjJ6

This is the line 66 :

 preg_match("/\.css/i", $stylesheet, $matches);

This is the line 70:

  if( $stylesheet ) wp_enqueue_style( $font, $stylesheet, 1, 2 ); 

I try to fixed but failed on the newest PHP version. Really appreciate for all your help. Thanks

我收到了这样的通知错误: p>

注意:wp-content / themes / aquasize / admin / library / engines / typography-engine.php:66 - 未定义的变量:stylesheet p>

注意:wp-content / themes / aquasize / admin / library / engines / typography -engine.php:70 - 未定义的变量:stylesheet p>

这里是我的完整代码: http://pastebin.com/VsrHzjJ6 p>

这是第66行: p>

  preg_match(“/ \。  css / i“,$ stylesheet,$ matches); 
  code>  pre> 
 
 

这是第70行: p>

  if  ($ stylesheet)wp_enqueue_style($ font,$ stylesheet,1,2);  
  code>  pre> 
 
 

我尝试修复但最新的PHP版本失败了。 非常感谢你的帮助。 谢谢 p> div>

Try adding:

/**
 * This will log all errors notices and warnings to a file called debug.log in
 * wp-content (if Apache does not have write permission, you may need to create
 * the file first and set the appropriate permissions (i.e. use 666) )
 */
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors',0);

near the top in your wp-config.php file on your development install.

Updated

these are notices and warnings not errors. Either define the variable, or turn error reporting for notices off.

Please try to define it on top of code for globally. Or define out side the calling function.

$stylesheet= "";