×ðÁú¿­Ê±

laravel ͼƬ·ÅÔÚÄÄ

laravel ÊÇÏÖ½ñºÜÊÇÊܽӴýµÄ php web Ó¦Óÿª·¢¿ò¼Ü£¬ËüÌṩÁËһϵÁÐÇ¿Ê¢µÄ¹¦Ð§ºÍ¹¤¾ß£¬Àû±ã¿ª·¢Ö°Ô±¸ßЧµØ¹¹½¨ web Ó¦ÓóÌÐò¡£ÔÚ¿ª·¢ web Ó¦ÓóÌÐòʱ£¬Í¨³£ÐèÒªÉÏ´«¡¢´æ´¢ºÍչʾͼƬµÈ¶àýÌåÎļþ¡£ÄÇô£¬ÔÚ laravel ÖУ¬ÎÒÃÇÓ¦¸Ã°ÑͼƬ·ÅÔÚÄÇÀïÄØ£¿ÕâÊDZ¾ÎĽ«ÒªÌ½ÌÖµÄÎÊÌâ¡£

Laravel ĬÈϵĴ洢λÖÃ

Laravel Ó¦ÓóÌÐòÌṩÁËÒ»¸öĬÈϵĴ洢λÖ㬳ÆΪ storage Ŀ¼£¬ÆäÖаüÀ¨ÁËÓ¦ÓóÌÐòËùÐèµÄËùÓÐÎļþºÍĿ¼¡£ÔÚÕâ¸öĿ¼ÖУ¬Laravel ÌṩÁËÒ»¸ö½Ð×ö public µÄ×ÓĿ¼£¬ÓÃÓÚ´æ·ÅÓ¦ÓóÌÐò¹«¹²µÄ¾²Ì¬×ÊÔ´£¬ÀýÈçͼƬ¡¢JavaScript ºÍ CSS ÎļþµÈ¡£¶øÁíÍâÒ»¸ö½Ð×ö app µÄ×ÓĿ¼£¬ÔòĬÈÏÓÃÓÚ´æ´¢Ó¦ÓóÌÐòµÄÆäËûÎļþ¡£

Òò´Ë£¬ÔÚ Laravel Ó¦ÓóÌÐòÖУ¬ÎÒÃÇ¿ÉÒÔ°ÑͼƬÎļþ°²ÅÅÔÚ public Ŀ¼ÖеÄÈκÎÒ»¸ö×ÓĿ¼Ï£¬ÀýÈç´æ´¢Óû§ÉÏ´«µÄÍ·ÏñͼƬ£¬¿ÉÒÔ½«ËüÃÇ´æ´¢ÔÚ public/images/avatars Ŀ¼Ï¡£¶øÔÚÓ¦ÓóÌÐòÖУ¬ÎÒÃÇ¿ÉÒÔͨ¹ý»á¼ûÏìÓ¦µÄ URL À´Õ¹Ê¾ÕâЩͼƬ¡£ÀýÈ磬ÏÖÔÚÓÐÒ»ÕÅͼƬ½Ð×ö terry.png ´æ´¢ÔÚ public/images Ŀ¼Ï£¬ÎÒÃÇ¿ÉÒÔʹÓÃÒÔÏ´úÂëÀ´ÔÚÓ¦ÓóÌÐòÖÐչʾËü£º

<img  alt="laravel ͼƬ·ÅÔÚÄÄ" >

µÇ¼ºó¸´ÖÆ

ÕâÑù£¬µ±Óû§»á¼ûÓ¦ÓóÌÐòµÄij¸öÒ³Ãæʱ£¬Ëü½«ÏÔʾ×ÅÃûΪ terry.png µÄͼƬ¡£

ÆäËû´æ´¢Ñ¡Ïî

³ýÁËĬÈϴ洢λÖÃÒÔÍ⣬Laravel »¹ÌṩÁËһЩÆäËûµÄ´æ´¢Ñ¡ÏÓÃÓÚ¸üÎÞаµØ´æ´¢ºÍÖÎÀí¶àýÌåÎļþ¡£

ÍâµØÎļþϵͳ´æ´¢

Laravel ÌṩµÄÍâµØÎļþϵͳÇý¶¯Æ÷ÔÊÐí½« Laravel Ó¦ÓóÌÐòµÄ´æ´¢Â·¾¶Ö¸ÏòÍâµØ´ÅÅÌÉϵÄÈκÎÒ»¸öĿ¼£¬ÕâÑù¿ÉÒÔ¸üÀû±ãµØÖÎÀí¶àýÌåÎļþ¡£ÀýÈ磬ÎÒÃÇ¿ÉÒÔ½«Ó¦ÓóÌÐò¹«¹²Îļþ´æ´¢ÔÚ /var/www/myapp/public Ŀ¼Ï£¬Í¬Ê±½«Ó¦ÓóÌÐò˽ÓÐÎļþ´æ´¢ÔÚ /var/www/myapp/storage Ŀ¼Ï¡£ÔÚÓ¦ÓóÌÐòÖУ¬ÎÒÃÇ¿ÉÒÔʹÓÃÒÔÏ´úÂëÀ´»á¼ûÕâЩÎļþ£º

Storage::disk('public')-&gt;get($pathToFile);

µÇ¼ºó¸´ÖÆ

ÆäÖУ¬$pathToFile ÌåÏÖÒª»á¼ûµÄÎļþ·¾¶£¬ÎÒÃÇ¿ÉÒÔÔÚÓ¦ÓóÌÐòµÄÈκεط½Ê¹ÓÃÕâ¸ö API¡£

ÔÆ´æ´¢Çý¶¯

Laravel ÌṩÁ˶àÖÖÔÆ´æ´¢Çý¶¯£¬ÀýÈç Amazon S3¡¢Rackspace¡¢Google Cloud Storage µÈ£¬¿ÉÒÔÀû±ãµØ½«¶àýÌåÎļþ´æ´¢µ½ÕâЩÔƴ洢ЧÀÍÖС£Ê¹ÓÃÕâЩÔÆ´æ´¢Çý¶¯£¬¿ÉÒÔʵÏÖ¸üÇ¿Ê¢¡¢¸ßЧµÄ´æ´¢ºÍÖÎÀí¼Æ»®¡£

ÀýÈ磬ʹÓà Amazon S3 ЧÀÍ£¬ÎÒÃÇ¿ÉÒÔ½«Í¼Æ¬´æ´¢µ½ÃûΪ myapp µÄ S3 ´æ´¢Í°ÖУ¬Ê¹ÓÃÒÔÏ´úÂëÔÚÓ¦ÓóÌÐòÖлá¼ûÕâЩͼƬ£º

Storage::disk('s3')-&gt;url('myapp/images/terry.png');

µÇ¼ºó¸´ÖÆ

ÕâÑù£¬Laravel »áΪÎÒÃÇÌìÉúÒ»¸öÓÉ Amazon S3 ЧÀÍÌṩµÄ URL µØµã£¬´Ó¶øÀû±ãµØչʾ´æ´¢ÔÚ S3 ´æ´¢Í°ÖеÄͼƬ¡£

×ÛÉÏËùÊö£¬Laravel ÌṩÁ˶àÖÖ´æ´¢ºÍÖÎÀí¶àýÌåÎļþµÄ·½·¨¡£¿ª·¢Ö°Ô±Ó¦¸Ãƾ֤×Ô¼ºÓ¦ÓóÌÐòµÄÐèÇóÑ¡ÔñÏìÓ¦µÄ´æ´¢¼Æ»®£¬ÒÔʵÏÖ¸üÎÞа¡¢¸ßЧµØ´æ´¢ºÍÖÎÀí¶àýÌåÎļþ¡£

ÒÔÉϾÍÊÇlaravel ͼƬ·ÅÔÚÄĵÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±ÊµÊ±ÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
¡¾ÍøÕ¾µØͼ¡¿¡¾sitemap¡¿