Tell me more ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Code i added ([a-zA-Z0-9\_\-]+) but not work i wan't to include all css files is there is any other way to add??

My code file css.php

header("Content-type: text/css");
$css = array(
     '([a-zA-Z0-9\\_\\-]+).css',
);

foreach ($css as $css_file) {
    $css_get = file_get_contents($css_file);
    echo $css_get;
    }

call.php

<link href="css.php" rel="stylesheet" type="text/css" />

i wan't to rewrite css.php to css.css so public can see css.css instead of css.php. how can i do that using php script?

share|improve this question
[Flagging for migration.] I would really like to see the story behind why you're trying to do this this, in this way... Also, why does that array have the same value twice? – Su' Jul 1 '12 at 10:35

closed as off topic by Su', John Conde Jul 1 '12 at 15:24

Questions on Webmasters Stack Exchange are expected to relate to webmastering within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

1 Answer

I don't believe you can do it like this.

Here is a simple pseudo code how you should do this:

  • Scan folder, get array of files (scandir function)
  • prepare regex array
  • Go through array
    • check if matches any regex
    • include if yes
    • skip if no
share|improve this answer
how can i do this please post code – John Smiith Jul 1 '12 at 10:37
Coded from my mind not sure if it will actually work. It will give you basic idea how to do it. pastebin.com/77RsSUu5 – user1188570 Jul 1 '12 at 10:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.