php - 无法在第 9 行的 Colorido.class.php 中重新声明之前在 Colorido.class.php:9 中声明的 wfColoridoRender
问题描述
执行这部分代码时出现以下错误:
无法在 /data/web/a1/eb/ 中重新声明 wfColoridoRender()(之前在 /data/web/a1/eb/4e/.../htdocs/wiki/extensions/Colorido/Colorido.class.php:9 中声明)第 9 行的 4e/.../htdocs/wiki/extensions/Colorido/Colorido.class.php
这段代码有什么问题?我不明白出了什么问题
代码完成:
<?php
$wgHooks['ParserFirstCallInit'][] = 'onParserFirstCallInit';
function onParserFirstCallInit( Parser $parser ) {
$parser->setHook( 'colorido', 'wfColoridoRender' );
}
include_once wfColoridoRender( $input, $argv, $parser ) {
// Character styles
$input = utf8_decode($input);
$output = ""; // To stop the "Undefined Variable" errors in the webserver logfile
for ($i = 0; $i < strlen($input); $i++)
{
$s = rand(0, 9) * 8 + 150;
$w = rand(5, 9) * 100;
$r = rand(20, 230);
$g = rand(20, 230);
$b = rand(20, 230);
$output .=
'<span style="font-size: ' . strval($s) . '%; font-weight:'
. strval($w) . ';color: #' . dechex($r) . dechex($g) . dechex($b)
. ';">';
$output .= $input[$i];
$output .= '</span>';
}
return utf8_encode($output);
};
解决方案
推荐阅读
- c# - 访问 IdentityServer 中的 UserInfo 端点
- curl - 使用 curl 通过 imap 删除消息
- css - 使用 JSX 或 Bootstrap 定位位于列表项上的锚元素的最有效方法是什么
- node.js - 使用运行时函数的 Twilio SSML
- tsql - SQL Server 从 2014 升级到 2017 和序号
- javascript - 向 Firebase 发出 POST 请求,但未按预期工作
- html - div 不会居中 CSS
- python - 精灵之间的pygame碰撞
- spring-cloud-gateway - Spring Cloud Gateway 动态路由
- python - 错误 #15:正在初始化 libiomp5.dylib,但发现 libiomp5.dylib 已经初始化