How to create install.php including steps like a s

2019-08-06 05:44发布

问题:

I would like to create an install.php for my tiny cms but i have a lot of questions.

-How to display install.php before the index.php?
-I would like to create steps, like in a shopping cart. The steps are:
    step1: (hi! are you ready? -submit-)
    if step1 is completed->step2:form(database-host-user-pass)->saves config.php and creates the tables
    if step2 is completed->step3:(admin username,admin pass,page title)->insert into admin
    if step3 is completed->step4:the install.php deletes itself.
-Is it possible to do it with one file?

I have most of the code of the steps in a file, the last question is, how to create steps.
Do i have to do something with session or with some id-s? How to?

回答1:

There are plenty of ways you could do this.

  1. Why not rename install.php to index.php and then rename index.php to something like begin.php

  2. And then on your begin.php page you could do a series of divs and only display one of them at a time. When you click the "next" button, div1 would disappear, and div2 would appear. And so on and so forth. I made a jsfiddle that kind of demonstrates this: http://jsfiddle.net/vVsAn/2110/ Note that this assumes you have jquery installed.

  3. Instead of deleting install.php (which is now index.php) you would put a check at the top of index.php that goes something like this

    if (installed == true) { //show content } else { //show installer divs }



回答2:

This is the solution: http://tutsforweb.blogspot.hu/2012/02/php-installation-script.html I hope, it will be useful to everybody with the same problem.