gpt4 book ai didi

php - 第 5 行的 fatal error : Call to undefined function base_url() in C:\wamp\www\Test-CI\application\views\layout. php

转载 作者:IT王子 更新时间:2023-10-29 00:56:23 25 4
gpt4 key购买 nike

你好,我是 CodeIgniter 和 PHP 的新手,我第一次尝试设置它,但出现以下错误。

Fatal error: Call to undefined function base_url() in

  1. C:\wamp\www\Test-CI\application\views\layout.php on line 5
     

  2. {main}( ) IN ..\index.php:0 require_once('C:\wamp\www\Test-CI\system\core\CodeIgniter.php' ) IN ..\index.php:202

  3. call_user_func_array ( ) IN ..\CodeIgniter.php:359

  4. Home->index( ) IN ..\CodeIgniter.php:0

  5. CI_Loader->view( ) IN ..\home.php:17

  6. CI_Loader->_ci_load( ) IN ..\Loader.php:419

  7. include('C:\wamp\www\Test-CI\application\views\layout.php' ) IN ..\Loader.php:833

我的代码:

 <html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Galleriffic | Custom layout with external controls</title>
<link rel="stylesheet" href="<?php base_url(); ?>/assets/css/basic.css" type="text/css" />
<link rel="stylesheet" href="<?php base_url(); ?>/assets/css/galleriffic-5.css" type="text/css" />

<!-- <link rel="stylesheet" href="<?php base_url(); ?>/assets/css/white.css" type="text/css" /> -->
<link rel="stylesheet" href="<?php base_url(); ?>/assets/css/black.css" type="text/css" />

<script type="text/javascript" src="<?php base_url(); ?>/assets/js/jquery-1.3.2.js"></script>
<script type="text/javascript" src="<?php base_url(); ?>/assets/js/jquery.history.js"></script>
<script type="text/javascript" src="<?php base_url(); ?>/assets/js/jquery.galleriffic.js"></script>
<script type="text/javascript" src="<?php base_url(); ?>/assets/js/jquery.opacityrollover.js"></script>
<!-- We only want the thunbnails to display when javascript is disabled -->
<script type="text/javascript">
document.write('<style>.noscript { display: none; }</style>');
</script>
</head>

最佳答案

您必须加载 url助手来访问该功能。要么添加

$this->load->helper('url');

在你的 Controller 中的某个地方。

或者,要让它在任何地方自动加载,请确保 application/config/autoload.php 中的行看起来像

$autoload['helper'] = array('url');

在该数组中有 'url'(如上所示)。

关于php - 第 5 行的 fatal error : Call to undefined function base_url() in C:\wamp\www\Test-CI\application\views\layout. php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11581636/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com