±¾ÎÄʵÀý½²ÊoÁËCI¿o¼ÜʹÓÃcomposer°²×°µÄÒÀÀµ°uµÄÏa¹Ø²Ù×÷²½ÖeÓe½¨¡£*ÖÏi¸ø´o¼Ò¹(C)´o¼Ò²Î¿¼£¬¾ßÌaÈçÏ£º
±¾ÎÄÕe¶Ô Linux ϵͳ£¬windows µÚÒ»²½ ¸u¾Ý composer ¹ÙÍø½øÐа²×° ºoÃaeµÄ²½ÖeÏaͬ
step 1 È«¾Ö°²×° composer
$ curl -sS https://getcomposer.org/installer | php
$ mv composer.phar /usr/local/bin/composer
step 2 ´´½¨composer.json µ½ÄaµÄÏiÄ¿¸uĿ¼
{
"require": {
"kriswallsmith/buzz": "*"
}
}
ÕaÀi½«Ìi¼ÓÒ»¸o Buzz package, ÓÃÀ´´¦Ài HTTP Request / Response PHP 5.3.x Àa.
step 3 Ö´ÐÐÈçÏÂÃuÁi ÏÂÔØÒÀÀµ°u
$ composer install
Ö®ºoÄa»a×¢Òaµ½ composer ´´½¨ÁËÒ»¸o ./vendors ÔÚÄaµÄÓ¦ÓÃĿ¼Ài ¶øÇÒ´uÂeÒ²ÔÚÀiÃae.
step 4 ÔÚÏiÄ¿ÖÐÌi¼Ó°uµÄ×Ô¶¯¼ÓÔØ
¼ÓÉÏÏÂÃaeÒ»ÐÐÔÚÄaµÄ index.php Ài
require_once './vendor/autoload.php';
ÐeÒª¼ÓÔØÔÚ
require_once BASEPATH.'core/CodeIgniter.php';
Ç°Ãae
step 5 ²aÊÔ
Àý×ÓÈçÏÂ:
class Test extends CI_Controller
{
public function index()
{
$browser = new Buzz\Browser();
$response = $browser->get('http://www.baidu.com');
echo $browser->getLastRequest()."\n";
echo $response;
}
}
²e¿´¸u¶a¿ÉÓðu¿ÉÒÔ²e¿´ Packagist
¸u¶a¹ØÓÚCodeIgniterÏa¹ØÄÚÈݸÐÐËȤµÄ¶ÁÕ߿ɲe¿´±¾Õ¾×¨Ìa£º¡¶codeigniterÈeÃŽ̡̳¡¢¡¶CI(CodeIgniter)¿o¼Ü½ø½×½Ì³Ì¡¡¢¡¶phpÓÅÐa¿ª*¢¿o¼Ü×ܽa¡¡¢¡¶ThinkPHPÈeÃŽ̡̳¡¢¡¶ThinkPHP³£Óý¨×ܽa¡¡¢¡¶Zend FrameWork¿o¼ÜÈeÃŽ̡̳¡¢¡¶phpÃaeÏo¶ÔÏo³ÌÐoÉe¼ÆÈeÃŽ̡̳¡¢¡¶php+mysqlÊý¾Ý¿a²Ù×÷ÈeÃŽ̡̳¼°¡¶php³£¼uÊý¾Ý¿a²Ù×÷¼¼ÇÉ»a×Ü¡*
Ï£Íu±¾ÎÄËuÊo¶Ô´o¼Ò»uÓÚCodeIgniter¿o¼ÜµÄPHP³ÌÐoÉe¼ÆÓÐËu°iÖu¡£