php - 如何修复(不能在第 214 行的 /Timber/functions/functions-twig.php 中使用 $this 作为参数)
问题描述
致命错误:不能在第 214 行的 /www/webvol14/pn/nlr3fq63bvk0q48/skywork.se/public_html/wp-content/themes/startup/vendor/Timber/functions/functions-twig.php 中使用 $this 作为参数
网站:php 7.1
/**
* @param mixed $this
* @return string
*/
function twig_get_class($this) {
return get_class($this);
}
/**
* @param mixed $this
* @return string
*/
function twig_get_type($this) {
return gettype($this);
}
解决方案
如php手册中所述:
警告 请注意,变量变量不能在函数或类方法中与 PHP 的超全局数组一起使用。变量 $this 也是一个不能动态引用的特殊变量。
https://www.php.net/manual/en/reserved.variables.globals.php#120071
推荐阅读
- node.js - 使用 MongoDB 和 Node.js 查询不返回任何结果
- xamarin - 将 OnAppearing 传递给 Xamarin Forms MVVM 中的 ViewModel?
- flutter-layout - Container within a Container size
- latex - 使用外语的乳胶导致引用错误
- javascript - Ionic 3:单击按钮时增加项目数
- jenkins - Jenkins Pipeline - 重新启动时如何获取内部版本号?
- python - 在我的网络抓取中,一些 div 没有出现
- django - Django 无法显示保存在数据库中的图片
- python - 通过浏览器访问端点时,CreateAPIView 使用 st() 函数返回 TypeError
- ios - 从 Laravel 发送 Firebase 推送通知