尊龙凯时人生就是搏

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¡¢ÍøÕ¾µØͼ