寂寞大萝卜 发表于 2017-4-12 11:12:50

zend framework Bootstrap.php数据库适配器配置及错误解决

( ! ) Zend_Config_Exception: parse_ini_file(F:\xampp\htdocs\zendfrm\application\application.ini) : failed
to open stream: No such file or directory in F:\xampp\htdocs\zendfrm\library\Zend\Config\Ini.php on line
182 Call Stack #TimeMemoryFunctionLocation 10.0030340224{main}( )..\index.php:0 20.0048434800Zend_Application->__construct(
string(11), string(59) )..\index.php:24 30.0098781416Zend_Application->setOptions(
array(5) )..\Application.php:92 40.0099782672Zend_Application->setBootstrap(
string(49), string(9) )..\Application.php:184 50.01361026872Bootstrap->__construct(
object(Zend_Application) )..\Application.php:325 60.02261345440Zend_Config_Ini->__construct(
string(51), string(5), ??? )..\Bootstrap.php:13 70.02261345472Zend_Config_Ini->_loadIniFile(
string(51) )..\Ini.php:126 80.02261345472Zend_Config_Ini->_parseIniFile(
string(51) )..\Ini.php:202



  ( ! ) Fatal error: Uncaught exception 'Zend_Config_Exception' with message 'parse_ini_file(F:\xampp\htdocs\zendfrm\application\application.ini) :
failed to open stream: No such file or directory' in F:\xampp\htdocs\zendfrm\library\Zend\Config\Ini.php on line
182


  ( ! ) Zend_Config_Exception: parse_ini_file(F:\xampp\htdocs\zendfrm\application\application.ini) :
failed to open stream: No such file or directory in F:\xampp\htdocs\zendfrm\library\Zend\Config\Ini.php on line
182


  Call Stack


  #
  Time
  Memory
  Function
  Location



  1


  0.0030


  340224


  {main}( )


  ..\index.php:0




  2


  0.0048


  434800


  Zend_Application->__construct( string(11),
string(59) )


  ..\index.php:24




  3


  0.0098


  781416


  Zend_Application->setOptions( array(5) )


  ..\Application.php:92




  4


  0.0099


  782672


  Zend_Application->setBootstrap( string(49),
string(9) )


  ..\Application.php:184




  5


  0.0136


  1026872


  Bootstrap->__construct( object(Zend_Application) )


  ..\Application.php:325




  6


  0.0226


  1345440


  Zend_Config_Ini->__construct( string(51),
string(5), ??? )


  ..\Bootstrap.php:13




  7


  0.0226


  1345472


  Zend_Config_Ini->_loadIniFile( string(51) )


  ..\Ini.php:126




  8


  0.0226


  1345472


  Zend_Config_Ini->_parseIniFile( string(51) )


  ..\Ini.php:202



  路径错误和路径分隔符错误:
  <?php
  class Bootstrap extends Zend_Application_Bootstrap_Bootstrap

{

//启动

function __construct($app){

parent::__construct($app);

file_put_contents("d:/mylog.txt", __FILE__.date('y-m-d h:i:s')."\r\n",FILE_APPEND);



//初始化我们的数据库适配器
$url=constant("APPLICATION_PATH").DIRECTORY_SEPARATOR.'configs'.DIRECTORY_SEPARATOR.'application.ini';

$dbconfig=new Zend_Config_Ini($url,"mysql");

$db=Zend_Db::factory($dbconfig->db);

$db->query('SET NAMES UTF8');

Zend_Db_Table::setDefaultAdapter($db);

}
  }
  ok..............................................................................................................................................

i am harry

Welcome to the Zend Framework!


This is your project's main page

  Helpful Links:
Zend Framework Website |
Zend Framework Manual






Zend_Db_Table_Rowset Object
(
=> Array
(
=> Array
(
=> 1
=> 张三
=> 李海
=> 2012-07-19 14:01:33
=> 你好啊,还在吗?
)
=> Array
(
=> 2
=> 李四
=> 张国荣
=> 2012-07-09 14:02:18
=> 风继续吹
)
=> Array
(
=> 3
=> 回音哥
=> 郭德纲
=> 2012-07-26 14:02:39
=> 我的歌声里
)
=> Array
(
=> 4
=> 李逍遥
=> 大s
=> 2012-07-26 14:03:25
=> 真漂亮
)
=> Array
(
=> 5
=> 张柏芝
=> 谢霆锋
=> 2012-07-27 14:04:39
=> 原谅我吧
)
=> Array
(
=> 6
=> 周立波
=> 周瑾
=> 2012-07-30 14:05:13
=> 你不和我搭档了吗?
)
=> Array
(
=> 7
=> 李云龙
=> 刘少奇
=> 2012-07-17 14:07:08
=> 我是华野的
)
=> Array
(
=> 8
=> 毛总东
=>
=> 2012-07-25 14:07:40
=> 全心全意为人民服务
)
=> Array
(
=> 9
=>
=>
=> 2012-07-25 14:08:10
=> 发展是硬道理
)
)
=> Message Object
(
=> message
=> Array
(
=> message_id
)
=>
=>
=> Zend_Db_Adapter_Pdo_Mysql Object
(
=> mysql
=> Array
(
=> 0
=> 1
=> 2
=> 0
=> 0
=> 0
=> 0
=> 0
=> 1
=> 1
=> 2
=> 2
=> 2
=> 2
=> 2
=> 2
)
=> Zend_Db_Statement_Pdo
=> Array
(
=> localhost
=> root
=> root
=> testzf
=>
=>
=> Array
(
=> 0
=> 1
=> 2
)
=> Array
(
)
)
=> 2
=> Zend_Db_Profiler Object
(
=> Array
(
)
=>
=>
=>
)
=> Zend_Db_Profiler
=> PDO Object
(
)
=> 0
=> 1
=> 1
=>
)
=>
=> Array
(
=> message_id
=> sender
=> getter
=> sendtime
=> content
)
=> 1
=> 1
=> Array
(
=> Array
(
=>
=> message
=> message_id
=> 1
=> int
=>
=>
=>
=>
=>
=> 1
=> 1
=> 1
=> 1
)
=> Array
(
=>
=> message
=> sender
=> 2
=> varchar
=>
=>
=> 64
=>
=>
=>
=>
=>
=>
)
=> Array
(
=>
=> message
=> getter
=> 3
=> varchar
=>
=>
=> 64
=>
=>
=>
=>
=>
=>
)
=> Array
(
=>
=> message
=> sendtime
=> 4
=> datetime
=>
=>
=>
=>
=>
=>
=>
=>
=>
)
=> Array
(
=>
=> message
=> content
=> 5
=> varchar
=>
=>
=> 2000
=>
=>
=>
=>
=>
=>
)
)
=>
=> 1
=> Zend_Db_Table_Row
=> Zend_Db_Table_Rowset
=> Array
(
)
=> Array
(
)
=> defaultNone
=> Array
(
)
)
=> 1
=> Message
=> Zend_Db_Table_Row
=> 0
=> 9
=> Array
(
)
=> 1
=>
)
页: [1]
查看完整版本: zend framework Bootstrap.php数据库适配器配置及错误解决