codeigniter 相关问题

CodeIgniter是由EllisLab公司创建的开源PHP Web开发框架,它已被不列颠哥伦比亚理工学院采用。该框架实现了Model-View-Controller设计模式的修改版本。有关CodeIgniter类,方法,函数,语法和用法的问题,请使用此标记。

尝试连接 api 以使用 docusign 时显示 PARTNER_AUTHENTICATION_FAILED

**致命错误**:未捕获 DocuSign\eSign\Client\ApiException: 请求服务器时出错,收到不成功的 HTTP 代码 \[401\],响应正文:O:8:"stdClass":2: {s:9:“

回答 1 投票 0

Google 商家列表显示我作为教练钱包经销商的业务

这个网站是用最新版本的Codeigniter建立的,在Google搜索结果中我的公司名称下是这个?我的网站内容没有嵌入任何 HTM 中的此类信息...

回答 0 投票 0

Codeigniter 4 在本地工作正常,但在线生产服务器出现错误:CodeIgniter\View\Exceptions\ViewException

上传到服务器时 /应用程序 /public_html /小贩 /可写 并使用 https://server.com/home 我看到欢迎页面,但是当我使用 https://server.com/pages 时,我收到错误“CodeIgniter\View\Exce...

回答 1 投票 0

电子邮件未在运行 Ubuntu 的 ec2 实例上发送

我有以下用于发送电子邮件的代码。这在 MAMP 上运行良好;但不是在 LAMP 上。 $配置= [ 'crlf'=>“ “, '邮件类型' => 'html', '换行'=>“ “, '

回答 1 投票 0

安装了composer,但无法使用codeigniter控制器中的库

致命错误:未捕获错误:在 C:\xampp\htdocs 中找不到“DocuSign Sign\Configuration”类 ffiniks_staging ffiniks pp pplicatio

回答 0 投票 0

翻译月份名称的最佳方法

我正在使用Codeigniter!翻译月份名称的最佳方法是什么?我在 mysql 时间戳中有一个日期,如下所示: 2012-09-22 11:21:53 我可以将其转换为“2012 年 9 月 22 日”,其中包含 ph...

回答 4 投票 0

如何修复错误:count():参数必须是数组或实现 Countable 的对象

遇到 PHP 错误 严重性:警告 消息:count():参数必须是数组或实现 Countable 的对象 文件名:models/login_model.php 线路编号:17 回溯: 文件:C:\

回答 0 投票 0

在CodeIgniter中使用ajax和php上传多个图像文件

我在将多个图像文件上传到服务器端时遇到问题。如果有人能够突出显示代码的问题所在,那就太好了。 最初有 HTML 代码: 我在将多个图像文件上传到服务器端时遇到问题。如果有人能强调代码的问题是什么,那就太好了。 最初有 HTML 代码: <label class="col-form-label"><h4>Upload Images</h4></label> <div id="image-preview-container"> <!-- Preview images will be displayed here --> </div> <form id="uploadCert" enctype="multipart/form-data"> <input type="file" id="images" name="images" multiple="multiple" accept="image/*" style="display: none;"> <label for="images" class="btn btn-primary"> Add Image </label> </form> </div> 在 JavaScript 中定义 var selectedImages = []; //list of files in array 并捕获每个选定的文件 $("#images").change(function () { var file = this.files[0]; if (file) { ... // Append the container to the image preview container $("#image-preview-container").append(imageContainer); .. // Add the selected image file to the postData.images array selectedImages.push(file); $(this).val(""); } }); 提交后使用 AJAX $('#addcart').click(function () { // Add other form fields to formData var formData = new FormData(); ... formData.append("issuesBody", $("#fbody_").val()); ... if (selectedImages.length > 0) { // Append each selected image to formData for (var i = 0; i < selectedImages.length; i++) { var image = selectedImages[i]; if (image instanceof File) { // If it's a File object, append it to formData formData.append("images[]", image); } } } else { // If no selected images, set images[] to an empty array formData.append("images[]", []); } // Make the AJAX request event.preventDefault(); $.ajax({ url: "addcert", type: "POST", data: formData, dataType:"json", contentType:false, cache:false, processData: false, success: function(data){ // Handle a successful response ... }, error: function (xhr, status, error) { // Handle an error response ... } }); }); }); 在 PHP private function addNewCert(){ // Capture POST data $issuesBody = $this->input->post('issuesBody'); // Not sure if this is the way to capture the posted file data $images = $_FILES['images']; // Upload images to the server $uploadedFiles = $this->uploadimg($images); //Check if image uploads were successful if ($uploadedFiles === false) { // Handle the case where image uploads failed ... echo json_encode($output); return; } ... 最后在 uploadimg() 期间始终显示 'undefined',这里是代码 private function uploadimg($images) { $uploadedFiles = array(); // captured uploaded file name // Loop through each uploaded file for ($i = 0; $i < count($images['name']); $i++) { // Generate a unique file name or use the original name $originalFileName = $images['name'][$i]; $fileExtension = pathinfo($originalFileName, PATHINFO_EXTENSION); $file_name = uniqid() . '_' . $originalFileName; $config['upload_path'] = $this->uploadPath; $config['file_name'] = $file_name; $config['allowed_types'] = 'jpg|jpeg|png|gif'; $config['max_size'] = 2048; $config['encrypt_name'] = TRUE; $this->load->library('upload', $config); // Perform the upload if ($this->upload->do_upload('images')) { $uploadedFiles[] = $file_name; } else { // Handle the case where an upload failed return false; } } return $uploadedFiles; } 实际上,代码中存在不止一个问题。首先,您应该将 $this->load->library('upload',$config) 语句从 for 循环中取出。您需要从列表中的每个文件创建单个文件才能上传。如果我没记错的话,Codeigniter do_upload 方法不适用于多个文件。您可以像下面这样更新您的 uploadimg 方法: private function uploadimg($images) { $uploadedFiles = array(); // captured uploaded file name $config = [ 'upload_path' => './testUploads/', 'allowed_types' => 'jpg|jpeg|png|gif', 'max_size' => 2048, 'encrypt_name' => TRUE, ]; $this->load->library('upload', $config); // Loop through each uploaded file for ($i = 0; $i < count($images['name']); $i++) { // Generate a unique file name or use the original name $originalFileName = $images['name'][$i]; $fileExtension = pathinfo($originalFileName, PATHINFO_EXTENSION); $file_name = uniqid() . '_' . $originalFileName; $config['file_name'] = $file_name; $this->upload->initialize($config); $_FILES['singleImage']['name'] = $file_name; $_FILES['singleImage']['type'] = $images['type'][$i]; $_FILES['singleImage']['tmp_name'] = $images['tmp_name'][$i]; $_FILES['singleImage']['error'] = $images['error'][$i]; $_FILES['singleImage']['size'] = $images['size'][$i]; // Perform the upload if ($this->upload->do_upload('singleImage')) { $uploadedFiles[] = $file_name; } else { // Handle the case where an upload failed return false; } } return $uploadedFiles; } P.S 我明白了,您正在生成一个更易读的文件名。如果您想查找具有该命名结构的文件,您应该将配置数组中的 encrypt_name 字段设置为 false。

回答 1 投票 0

Codeigniter:禁止,您无权访问此资源。它指的到底是什么资源。?

在本地机器上一切正常。问题出在托管服务器上。 有一个视图('student/student_edit.php'),其中包含一个用于更新学生数据的表单及其相应的控制器('s...

回答 2 投票 0

未定义的属性:Auth::$auth_model

我遇到了一个不知道如何解决的问题。 我一直在尝试将其插入 autoload.php -$autoload['libraries'] = array('email', 'session', 'database', 'form_validation');- 但它

回答 0 投票 0

使用 $this->input->post() 时,如果在 $_POST 中找不到值,则将值声明为 null

如果我尝试在 POST 提交中访问的密钥为空或未找到,我该如何处理? 我当前的代码: $数据=数组( 'harga_jual' => $this->input->post('harga_...

回答 4 投票 0

CodeIgniter -> php Spark 服务不工作

我刚刚使用 CodeIgniter 创建了一个新项目。 我尝试运行此命令来运行服务器: php 火花服务 但它给了我这个错误: PHP 警告:require(/mnt/e/dev/learning/php/

回答 3 投票 0

Laravel 将本地主机 MySql 数据库同步到托管服务器

我想用 Laravel 制作离线在线 Web 应用程序。当用户有互联网连接时,需要自动同步 MySql 数据库,否则我将制作一个同步按钮。我尝试寻找解决方案,但是

回答 3 投票 0

如何将 Hotwire 与 codeigniter 一起使用?

最初,当我看到有人使用 Livewire 时,我对 Livewire 很感兴趣。但查了一下发现,livewire只能运行在Laravel上。同时,我自己只使用过代码点火器。 T...

回答 1 投票 0

MySQL 查询返回的期初余额不正确

我有如下视图来过滤从开始日期到结束日期的选定日期范围内接收和发出的项目,例如A4,A3,......。 接收用“购买”表示,并且

回答 1 投票 0

按 id 对 mysql 结果进行循环

我在mysql中有一个包含航班数据的表。我正在编写一个 php 代码,它将使用 codeigniter 3 对数据进行分组和显示 Journey_id Air_id FlightDuration out_or_in Flightdura...

回答 1 投票 0

CodeIgniter 4 - .env 文件的多个数据库问题

我正在使用CodeIgniter 4.0.3。我已经使用 Composer 通过以下方式安装了它: 作曲家创建项目 codeigniter4/framework 作曲家项目创建完成后出现一个错误(脚本 bash admin/

回答 2 投票 0

视图中的Codeigniter css

我添加了名为“css_url”的新功能。我在控制器的构造函数中设置,它有效。 此外,我想在资产方面达成共识。在视图目录中我放置了主题,每个主题都...

回答 1 投票 0

如何使用 Postman 将 DocuSign 与您的 CodeIgniter Web 应用程序集成?

我将 docusign 添加到我的邮递员中,现在我想在我的 codeignator Web 应用程序中使用邮递员,我该怎么做 作曲家需要 docusign/esign-client 无法安装这个库 C:\xampp\htd...

回答 1 投票 0

Codeigniter 3 中多输入如何工作,数据库文件中只上传一个,而不是多个文件?

请帮助我,亲爱的, 我想尝试在其他标题和其他上传文件上启用多个输入。 我制作的控制器是否有问题,因此它循环播放其他标题和多个

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.