显然,我的最后一个问题太模糊了,尽管它很简单。
我正在尝试使用Embed.ly的API来嵌入一些东西,例如,这里显示的一些东西。https://github.com/embedly/embedly-php/blob/master/README.rst
我的工作目录中有整个Embeddy.php源文件。
然而,当我的头文件中有以下内容时:
<?php
//require_once('Embedly/src/Embedly/Embedly.php'); // if using pear
require_once('./Embedly.php'); // if using source
$api = new Embedly'Embedly(array('user_agent' => 'Mozilla/5.0 (compatible; mytestapp/1.0)'));
?>
在我的主页上有以下内容:
<?php
$objs = $api->oembed(array(
'urls' => array(
'http://www.youtube.com/watch?v=sPbJ4Z5D-n4&feature=topvideos',
'http://twitpic.com/3yr7hk'
)
));
?>
我得到以下错误:
(!)致命错误:在第259行调用C:''wamp''www''Embedly.php中未定义的函数Embedly''curl_init()
看起来curl没有安装或启用。
如果你在自己的服务器上(假设类似于ubuntu服务器),一个简单的sudo apt-get install php5-curl
应该可以解决这个问题
否则,您可能需要联系您的托管提供商。
这是从论坛上得到的,看起来是合法的:
- 关闭WAMP(如果正在运行)
- 导航到WAMP''bin''php(您的php版本)''
- 编辑php.ini
- 搜索curl,取消注释extension=php_curl.dll
- 导航到WAMP''bin''Apache(您的Apache版本)''bin''
- 编辑php.ini
- 搜索curl,取消注释行/remove the#,extension=php_curl.dll
- 保存文件
- 重新启动WAMP