infrajs/infra

1.0.16 2016-03-02 14:55 UTC

This package is auto-updated.

Last update: 2024-08-28 22:32:20 UTC


README

查看

infra

  • 在 infra 空间中执行 php 文件的模式。 (index.php?-path/to/file.php)
  • 配置 - .infra.json 配置文件 Config::get()
  • 路径处理 - path, ~ data, - search, ! cache. Path::theme() Load::srcInfo()
  • 处理服务器 json 响应。 infra_ans(), Ans::ret(), Ans::err()
  • 测试 - -infra/tests.php (tests 目录扩展名)
  • 权限系统 - 开发者,测试者 Access::test() Access::debug()
  • 管理员认证 Access::admin()
  • 自动安装 update.php
  • 自动加载 config.plugin.require
  • 模板引擎 Template::parse()
  • 事件 Event::fire() Event::handler()
  • 浏览器缓存管理 header('Cache-Control: no-store') infra_cache_yes()
  • 按文件修改日期缓存 infra_cache
  • 准备 html 输出 View::html()
  • 处理字符串中的序列。分隔符可以是任何字符。 Sequence::right() Sequence::short()
  • 发送邮件 infra_mail_toAdmin() infra_mail_fromAdmin()
  • 文件系统或 memcached 中的缓存处理

通过 composer 安装后,功能可通过文件 vendor/infrajs/infra/index.php 访问。要执行测试,需要在浏览器中打开 vendor/infrajs/infra/index.php?-infra/tests.php

扩展 infrajs/imager 接受图片路径和要调整的宽度。

?-imager/imager.php?src=~mypic.jpg&w=100

在 php 和 javascript 脚本中使用统一的路径格式 - 相对于网站根目录的路径,无论 php 或 js 文件的位置。所有与文件系统交互的函数都配置为使用此类地址格式。路径也可以包含上述特殊符号 *, ~, |。

如果扩展独立运行

vendor/infrajs/imager/imager.php?src=images/mypic.jpg&w=100

并在 infra 空间中。

vendor/infrajs/infra/?-imager/imager.php?src=~mypic.jpg&w=100
?-imager/imager.php?src=*mypic.jpg&w=100

库内的路径应转换为绝对路径。实际上,两种工作方式之间的区别在于 php 中的当前工作目录。

require_once(__DIR__.'/../../../vendor/autoload.php'); //Правильная запись

支持 infra 的 index.php

<?php
	require_once('vendor/autoload.php');
	infrajs\infra\Infra::init();

infra 已安装

  • vendor/infrajs/infra/index.php?~mypic.jpg
  • vendor/infrajs/infra/?~mypic.jpg