我们使用的平台是wordpress。 Wordpress正在实时服务器中运行。我正试图让它在我的本地机器上工作。
当我在本地计算机中替换wordpress文件时,它给了我这个错误
解析错误:语法错误,第788行的C:\ wamp \ www \ mywordpressdirectory \ wp-content \ mu-plugins \ wpengine-common \ plugin.php中的意外“公共”(T_PUBLIC)
此行具有此功能
public function disable_indiv_plugin_update_notices( $value ) {
$plugins_to_disable_notices_for = array();
$basename = '';
foreach ($plugins_to_disable_notices_for as $plugin) {
$basename = plugin_basename( $plugin );
}
if (isset($value->response[@$basename])) {
unset( $value->response[$basename] );
}
return $value;
}
我发现这个功能没有任何问题。此功能之前的上述内容是
function wpengine_credits() {
if (get_option('stylesheet') != 'twentyeleven' && get_option('template') != 'twentyeleven') {
return false;
}
if (!defined('WPE_FOOTER_HTML') OR !WPE_FOOTER_HTML OR $this->already_emitted_powered_by == true) {
return false;
}
//to prevent repeating
$this->already_emitted_powered_by = true; ?>
<div id="site-host">
WP Engine <a href="http://wpengine.com" title="<?php esc_attr_e( 'Managed WordPress Hosting', 'wpengine' ); ?>"><?php printf( __( '%s.', 'wpengine' ), 'WordPress Hosting' ); ?></a>
</div>
<?php
}
现场制作服务器也使用5.5.9-1ubuntu4.11,而我的本地工作站是5.5.12
答案 0 :(得分:0)
unexpected 'public' (T_PUBLIC)
解决了这个问题。
public function disable_indiv_plugin_update_notices( $value ) {
应该是
function disable_indiv_plugin_update_notices( $value ) {
除非函数在类中,否则不需要关键字public
,protected
和private
(并且会破坏解析器)。