thinkhphp5中创建公共函数
有时候,我们需要在thinkhphp5中创建一些公共函数,操作如下:
一、创建
在application文件夹中创建common.php文件,填写以下内容:

<?php
    /**
    * 公共方法
    */
    function test($data) {
      $str = $data;
      return str;
    }

?>

二、调用
直接使用方法名调用即可。

相关文章:

  • 2021-10-11
  • 2021-09-11
  • 2022-02-08
  • 2023-03-20
  • 2021-06-21
  • 2021-10-17
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-18
  • 2022-01-16
  • 2022-12-23
  • 2021-08-27
  • 2022-12-23
相关资源
相似解决方案