如何从库中调用辅助函数 class
How to call a helper function from a library class
我有一个库 class "Weekprint.php" (libraries/Weekprint.php) 并且在帮助文件 (calendar_helper.php) 中我有类似
print_calendar($start, $events, $cal_type).
我可以分开使用,
我想 if/how 我可以从 Weekprint 调用 print_calendar。
我使用 Codeigniter 3.1.5
您可以调用图书馆的助手。 helper 在使用前需要加载。在 Weekprint.php 中选择合乎逻辑的位置,以通常的方式执行此操作。
$this->load->helper('calendar_helper');
以后需要的时候可以正常调用。
print_calendar($start, $events, $cal_type);
显然,辅助函数的各种参数需要赋值。
我能做到,
$CI = &get_instance();
$CI->load->helper('calendar_helper');
图书馆内Weekprint.php
我有一个库 class "Weekprint.php" (libraries/Weekprint.php) 并且在帮助文件 (calendar_helper.php) 中我有类似
print_calendar($start, $events, $cal_type).
我可以分开使用,
我想 if/how 我可以从 Weekprint 调用 print_calendar。
我使用 Codeigniter 3.1.5
您可以调用图书馆的助手。 helper 在使用前需要加载。在 Weekprint.php 中选择合乎逻辑的位置,以通常的方式执行此操作。
$this->load->helper('calendar_helper');
以后需要的时候可以正常调用。
print_calendar($start, $events, $cal_type);
显然,辅助函数的各种参数需要赋值。
我能做到,
$CI = &get_instance();
$CI->load->helper('calendar_helper');
图书馆内Weekprint.php