2016-01-28 26 views

回答

1

您可以将Predis SDK打包到您的应用程序中,并通过GIT或FTP一起部署到Azure Web Apps Service。 Create a PHP-MySQL web app in Azure App Service and deploy using Git欲了解更多信息。

此外,您可以简单地在composer.json中配置Predis SDK。

"require": { 
     "predis/predis": "1.*" 
    } 

然后在您的Azure Web Apps服务中安装composer扩展。然后,当您通过Git部署到Azure时,Azure部署任务将运行composer install命令以安装在该文件中配置的依赖关系和编辑器命令。

您可以参考How to install composer on app service?安装作曲家扩展

此外,如果您在Azure中利用Redis的缓存,你应该首先启用PHP集成非SSL端点: enter image description here

和代码代码段:

require 'vendor/autoload.php'; 
$client = new Predis\Client('redis://{your_redis_service_name}.redis.cache.windows.net'); 
$client->auth('{password key}'); 
$client->set('foo', 'bar'); 
$value = $client->get('foo'); 
echo $value; 
相关问题