duanmu8911 2013-02-12 15:01
浏览 314

使用配置文件中的值从配置文件加载数据

I have a config.ini file with some values. One of them is the path to the root of my script. So in my js file i get the content from the config.ini file, but i have one big mistake. To load the data from the config file i already need one value from the config file, namely the path to the config file.

Any idea how to handle that?

Regards Sylnois

Edit:

This is my htaccess:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}  -d

RewriteRule  ^.*$  -  [L]

RewriteRule ^([^/]+)/$  index.php?token=$1 [L]

This rewrites my link from http://domain.com/fun/bla/index.php?token?123 to http://domain.com/fun/bla/123/ .. So if someone access the second link, my js script would not be run anymore, cause i work with relative paths. I have now a value in my config which points to the root directory of my applicatoin: "./fun/bla/". Everything works so fine. But my requirement are, that no paths should be implemented in my code.

  • 写回答

3条回答 默认 最新

  • dongwuqi4243 2013-02-12 15:03
    关注

    Yes. Store the path to your config file in code. The rest can be loaded from the config file.

    You can't possibly have everything in a config file. I once worked with someone who tried to store database configuration in the database. And then realized their mistake when they tried to make the application, you know, work.

    评论

报告相同问题?