default.init.php 1.0 KB

1234567891011121314151617181920212223
  1. <?php
  2. if (!defined('IS_INITPHP')) exit('Access Denied!');
  3. /*********************************************************************************
  4. * InitPHP 3.8.1 国产PHP开发框架 View-default 默认模板驱动规则模型
  5. *-------------------------------------------------------------------------------
  6. * 版权所有: CopyRight By initphp.com
  7. * 您可以自由使用该源码,但是在使用过程中,请保留作者信息。尊重他人劳动成果就是尊重自己
  8. *-------------------------------------------------------------------------------
  9. * Author:zhuli Dtime:2014-11-25
  10. ***********************************************************************************/
  11. class defaultInit {
  12. /**
  13. * 模板驱动-默认的驱动
  14. * @param string $str 模板文件数据
  15. * @return string
  16. */
  17. public function init($str, $left, $right) {
  18. $pattern = array('/'.$left.'/', '/'.$right.'/');
  19. $replacement = array('<?php ', ' ?>');
  20. return preg_replace($pattern, $replacement, $str);
  21. }
  22. }