在 Windows 上使用 XAMPP 安装 PHP YAML 扩展

2024-04-12php开发问题
8

本文介绍了在 Windows 上使用 XAMPP 安装 PHP YAML 扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

大家好,我目前正在做一些关于 PhP 的工作,需要我使用 yaml_parse_file() 函数来解析 YAML 文件.我对这门语言还是陌生的,所以当我尝试在 Windows 上未经修改的 XAMPP 服务器上使用该函数时,我得到了错误找不到函数".经过一番研究,我发现您实际上应该在您的 php 安装上安装扩展才能使用该功能.http://php.net/manual/en/yaml.setup.php这个链接详细介绍了安装过程,我已经阅读了它,但是我对安装过程感到困惑.上面的链接指出没有可供下载的 DLL 包,但是直接对此链接发表评论 http://pecl.php.net/package/yaml 在这里您可以清楚地看到 YAML Parser 的 DLL 包.我的问题是您能否指导我了解如何使用 XAMPP 在 Windows 机器上执行此安装过程.

Hey folks I am currently doing some work on PhP that requires me to parse a YAML file by using the yaml_parse_file() function. I am still new to the language and all so when I tried using that function on my unmodified XAMPP server on Windows I got the error 'function not found'. After some research I found out that you are actually supposed to install extensions on your php installation to be able to use that function. http://php.net/manual/en/yaml.setup.php this link details the installation process and I have read through it however I am confused in regards to the installation procedure. The above link states that there is not a DLL package available for download however a comment direct to this link http://pecl.php.net/package/yaml where you can clearly see a DLL Package for YAML Parser. My question is if you could please walk me through how to go about this installation procedure on a Windows Machine using XAMPP.

https://code.google.com/p/php-yaml/wiki/InstallingWithPecl 这个链接可能会为您提供有关此主题的更多见解,尽管我无法理解它是如何工作的:(

https://code.google.com/p/php-yaml/wiki/InstallingWithPecl this link might offer you more insight on this topic although I fail to understand how it all works :(

Edit2:我试图下载上面链接中给出的 DLL 并将其添加到我的 php/ext 文件夹中,并在 php.ini extension=php_yaml.dll 中添加一个条目,但是当我尝试测试我的扩展程序是否已被以下脚本加载,我得到一个错误.

I have tried to download the DLL given on the above link and add it to my php/ext folder and add an entry in php.ini extension=php_yaml.dll but when I try to test if my extension has been loaded by the following script, I get an error.

<?php
if (extension_loaded(yaml))
  echo "yaml loaded :)";
else
  echo "something is wrong :(";
?>

推荐答案

在读者的帮助下,我似乎已经缩小了实现这一目标的步骤.

With a bit of help from the readers I seem to have narrowed down the steps to accomplish this.

  1. 下载最新的 YAML DLL 包
  2. 解压文件
  3. php_yaml.dll 文件移动到 xampp/php/ext 文件夹
  4. xampp/php中打开你的php.ini并添加extension=php_yaml.dll这一行,保存退出
  5. 现在将 yaml.dll 文件从 zip 文件夹内容中移动到 xampp/apache/bin 文件夹中
  6. 关闭并重新启动您的 XAMPP 服务器
  7. 加载一个php脚本echo phpinfo();
  8. 在页面上搜索字符串yaml.如果显示已启用,则您的 YAML 扩展正在运行.
  1. Download the latest YAML DLL Package
  2. Unzip the files
  3. Move the php_yaml.dll file to xampp/php/ext folder
  4. Open your php.ini in xampp/php and add the line extension=php_yaml.dll, save and exit
  5. Now move the yaml.dll file from the zip folder contents and move it to the xampp/apache/bin folder
  6. Close and restart your XAMPP Servers
  7. Load a php script echo phpinfo();
  8. Search the string yaml on the page. If it says Enabled then your YAML Extension is working.

这篇关于在 Windows 上使用 XAMPP 安装 PHP YAML 扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

PHP实现DeepL翻译API调用
DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以...
2025-08-20 php开发问题
168

PHP通过phpspreadsheet导入Excel日期数据处理方法
PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的...
2024-10-23 php开发问题
287

mediatemple - 无法使用 codeigniter 发送电子邮件
mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)...
2024-08-23 php开发问题
11

Laravel Gmail 配置错误
Laravel Gmail Configuration Error(Laravel Gmail 配置错误)...
2024-08-23 php开发问题
16

将 PHPMailer 用于 SMTP 的问题
Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)...
2024-08-23 php开发问题
4

关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题
Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)...
2024-08-23 php开发问题
17