伙计我是代码点火器的新手..我不明白如何使用这个框架.它只是打开用户指南.谁能告诉我在代码点火器上执行"hello world"程序需要遵循的步骤?
Cli*_*ote 10
hello.php在system/application/controllers文件夹中创建一个调用的文件.在文件中,输入以下代码:
<?php
class Hello extends Controller
{
function index()
{
echo 'Hello world!';
}
}
?>
Run Code Online (Sandbox Code Playgroud)
然后去http://localhost/codeigniter/index.php/hello,你应该看到你好世界.(您可能将其放在与codeigniter不同的目录中,因此请根据需要更改URL).
然后您可以将代码更改为:
<?php
class Hello extends Controller
{
function index()
{
echo 'Hello world!';
}
function test()
{
echo 'Second hello world!';
}
}
?>
Run Code Online (Sandbox Code Playgroud)
并将http://localhost/codeigniter/index.php/hello/test从该类运行'test'函数.
使用.htaccess和mod_rewrite,您可以从您的网址中删除'index.php',这样您就只能访问http://localhost/codeigniter/hello或http://localhost/codeigniter/hello/test.
| 归档时间: |
|
| 查看次数: |
14055 次 |
| 最近记录: |