Bir dizindeki resimlerin sayısını döndürmek için PHP nasıl kullanılır?

0 Cevap php

Ben böyle bir Javascript nesnesi vardır:

var count = {
            table:19,
            people:39,
            places_details:84,
            story_1:18,
            story_2:6,
            story_3:11
            }

Her öğe (tablo, kişi, vb) sitesi kökünde bir dizin within my graphics/ dizin. Ben ilgili dizinde JPG görüntüleri sayarak sayısal değerlerini sağlamak için PHP kullanmak istiyorum. Ben böyle bir şey hayal:

ar count = {
           table: <?php count(dir("table")) ?>,
           people: <?php count(dir("people")) ?>,
           places_details: <?php count(dir("places_details")) ?>,
           story_1: <?php count(dir("story_1")) ?>,
           story_2: <?php count(dir("story_2")) ?>,
           story_3:<?php count(dir("story_3")) ?>
           }

Ama JPG için filtre ve bir dizi dönmek gerekiyor. Doğru kodu nedir?

0 Cevap