本地主机错误 PHP codeigniter 4 本地主机运行错误

时间:2021-06-19 01:54:21

标签: php

我在 PHP Codeignitor 4 中有完整的代码,用于将数据插入数据库,但是每当我尝试访问 localhost 时,都会出现错误。

我也更改了我的基本网址,但没有任何效果...

我有项目名称 ci4_crud 然后应用程序和子文件夹我使用不同的链接,如 localhost/insert 或 localhost/ci4_crud/app/views/insert 但没有任何工作......

在 App.php 中,我的基本网址是 http://localhost/ci4_crud/

有人可以帮我吗

<!DOCTYPE html>  
<html>
<head>
<title> Registration Form </title>
</head>
<body>
<form method="post" action="<?=base_url() ?> Crud/savedata">
<table border="1" width="600">
  <tr>
<input type="text" name="first_name" placeholder="Enter First Name">
  </tr>
  <tr>
<input type="text" name="last_name" placeholder="Enter Last Name">
  </tr>
  <tr>
<input type="text" name="address" placeholder="Enter Address">
  </tr>
  <tr>
<input type="text" name="email" placeholder="Enter Email ID">
  </tr>
  <tr>
<input type="submit" name="save" value="Save Data">
  </tr>
</table>
</body>
</html>

2 个答案:

答案 0 :(得分:0)

尝试将以下规则放在第 17 行的 public/.htaccess 中:

RewriteBase /ci4_crud

答案 1 :(得分:0)

试试这个

action="<?php echo base_url(); ?>crud/savedata"

或者这个

action="<?php echo base_url(); ?>index/crud/savedata"

我还可以知道您收到什么错误消息。