本文整理汇总了PHP中Math::usage方法的典型用法代码示例。如果您正苦于以下问题:PHP Math::usage方法的具体用法?PHP Math::usage怎么用?PHP Math::usage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Math
的用法示例。
在下文中一共展示了Math::usage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exit
<?php
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
include_once PATH_THIRD . 'math/addon.setup.php';
$plugin_info = array('pi_author' => MATH_AUTHOR, 'pi_author_url' => MATH_AUTHOR_URL, 'pi_description' => MATH_DESC, 'pi_name' => MATH_NAME, 'pi_version' => MATH_VER, 'pi_usage' => Math::usage());
class Math
{
public $return_data = '';
public function __construct()
{
// Get formula
$formula = ee()->TMPL->fetch_param('formula');
$error = false;
$result = '';
if ($formula !== false) {
// Convert html entities to math characters
$formula = html_entity_decode($formula);
// Replace parameters
$params = ee()->TMPL->fetch_param('params');
$numeric_error = ee()->TMPL->fetch_param('numeric_error', 'Invalid input');
if ($params !== false) {
$params = explode('|', $params);
$i = 1;
foreach ($params as $param) {
if (!is_numeric($param)) {
$param = preg_replace('/[^0-9.]*/', '', $param);
if (!is_numeric($param)) {
$this->return_data = $numeric_error;
return;
示例2: exit
<?php
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
$plugin_info = array('pi_name' => 'Math', 'pi_version' => '1.4.1', 'pi_author' => 'Caddis', 'pi_author_url' => 'http://www.caddis.co', 'pi_description' => 'Use Math to execute PHP supported math formulas.', 'pi_usage' => Math::usage());
class Math
{
public $return_data = '';
public function __construct()
{
// Get formula
$formula = ee()->TMPL->fetch_param('formula');
$error = false;
$result = '';
if ($formula !== false) {
// Convert html entities to math characters
$formula = html_entity_decode($formula);
// Replace parameters
$params = ee()->TMPL->fetch_param('params');
$numeric_error = ee()->TMPL->fetch_param('numeric_error', 'Invalid input');
if ($params !== false) {
$params = explode('|', $params);
$i = 1;
foreach ($params as $param) {
if (!is_numeric($param)) {
$param = preg_replace('/[^0-9.]*/', '', $param);
if (!is_numeric($param)) {
$this->return_data = $numeric_error;
return;
}