所以我在mylibfunctions.php中使用了carbon api,当然也在页面本身。 PHP不会让你包含两次文件,所以如何在mylibfunctions.php中包含/引用该文件?
index.php:
<?php
include('session-info.php');
include('phpsqlinfo_dbinfo.php');
include('carbon.php');
use Carbon\Carbon;
include('mylibfunctions.php'); //using carbon functions here
不包括mylibfuncitons上的碳API文件会返回此错误:
Fatal error: Class 'Carbon' not found in /var/www/mylibfunctions.php on line 4
并包含它们会返回如下内容:
cannot require blah blah blah more than once. (not exact error message).
衷心感谢任何帮助。非常感谢!