扩展:Php标签

本頁使用了標題或全文手工轉換
From mediawiki.org
This page is a translated version of the page Extension:PhpTags and the translation is 48% complete.
MediaWiki的扩展的手冊
PhpTags
發佈狀態: 测试版
实现 标签 , 解析器函数 , 钩子
描述 允许用户使用带PHP语法的魔术表达式
作者 Pavel Astakhov (pastakhov讨论)
最新版本 5.5.0 (2015-11-20)
MediaWiki 1.25+
PHP 5.3+
许可协议 GNU通用公眾授權條款2.0或更新版本
下載
  • $wgPhpTagsMaxLoops
  • $wgPhpTagsNamespaces
  • $wgPhpTagsBytecodeExptime
phptag
季度下載量 14 (Ranked 162nd)
翻譯PhpTags的扩展,若在translatewiki.net可用
問題 尚未完成的工作 · 报告錯誤

PhpTags扩展允许用户使用带PHP语法魔术表达式,它允许您创建和使用兼容但不独立的MediaWiki扩展,设计适用于扩展设计时的初步性能测试。更多……

描述

The PhpTags extension has its own the runtime environment PHP code which supports scalar types, arrays, variables, operators, control structures. It also supports constants, functions and objects but it does not implement any of them except for some language constructs.

When using a function, object or constant PhpTags calls corresponding extension. Therefore, a set of constants, functions, objects and actions that they produce only depend on additionally installed compatible extensions which can be found here.

PhpTags designed so to be as similar to native PHP, therefore you should have the illusion of direct execution PHP code although this never happens.

用法

The code should be placed between the tags ‎<phptag> and ‎</phptag>. It can be located in any namespace if it is allowed by the variable $wgPhpTagsNamespaces.

<phptag>
$foo = 'hello world';
echo ucfirst( $foo . "!!!\n" );
</phptag>

它将显示:

Hello world!!! 
功能ucfirst执行于Extension:PhpTags_Functions More details can be found in the quick start guide.

安裝

  • 下载文件,并将其放置在您extensions/文件夹中的PhpTags目录内。
  • 将下列代码放置在您的LocalSettings.php 的底部:
    require_once "$IP/extensions/PhpTags/PhpTags.php";
    
  • Yes 完成 – 在您的wiki上导航至Special:Version,以验证已成功安装扩展。


Vagrant安装:

  • 如果使用Vagrant ,请通过vagrant roles enable phptags --provision安装

可选安装

附加安装

The PhpTags extension (core) implements magic expressions only and not, for instance, any PHP function.

For additional features such as functions, you can install additional extensions which are compatible with the magic expressions of the PhpTags extension.

主要的扩展有:

配置变量

名称 描述 默认
$wgPhpTagsMaxLoops Maximum number of allowed loops 1000
$wgPhpTagsNamespaces Array of namespaces in which the PhpTags extension is allowed to use. Boolean true allows usage in all namespaces true
$wgPhpTagsBytecodeExptime Storage time of the compiled bytecode in cache (30 days) 2592000 (30天)