<bdo id='98ifD'></bdo><ul id='98ifD'></ul>

    <tfoot id='98ifD'></tfoot>

  1. <legend id='98ifD'><style id='98ifD'><dir id='98ifD'><q id='98ifD'></q></dir></style></legend>

    <i id='98ifD'><tr id='98ifD'><dt id='98ifD'><q id='98ifD'><span id='98ifD'><b id='98ifD'><form id='98ifD'><ins id='98ifD'></ins><ul id='98ifD'></ul><sub id='98ifD'></sub></form><legend id='98ifD'></legend><bdo id='98ifD'><pre id='98ifD'><center id='98ifD'></center></pre></bdo></b><th id='98ifD'></th></span></q></dt></tr></i><div id='98ifD'><tfoot id='98ifD'></tfoot><dl id='98ifD'><fieldset id='98ifD'></fieldset></dl></div>

    <small id='98ifD'></small><noframes id='98ifD'>

      {PHP} 致命错误:不在对象上下文中使用 $this (Joomla)

      {PHP} Fatal error: Using $this when not in object context (Joomla)({PHP} 致命错误:不在对象上下文中使用 $this (Joomla))

      <small id='14rA8'></small><noframes id='14rA8'>

      • <bdo id='14rA8'></bdo><ul id='14rA8'></ul>
        <legend id='14rA8'><style id='14rA8'><dir id='14rA8'><q id='14rA8'></q></dir></style></legend>
        • <i id='14rA8'><tr id='14rA8'><dt id='14rA8'><q id='14rA8'><span id='14rA8'><b id='14rA8'><form id='14rA8'><ins id='14rA8'></ins><ul id='14rA8'></ul><sub id='14rA8'></sub></form><legend id='14rA8'></legend><bdo id='14rA8'><pre id='14rA8'><center id='14rA8'></center></pre></bdo></b><th id='14rA8'></th></span></q></dt></tr></i><div id='14rA8'><tfoot id='14rA8'></tfoot><dl id='14rA8'><fieldset id='14rA8'></fieldset></dl></div>
          <tfoot id='14rA8'></tfoot>

            <tbody id='14rA8'></tbody>

                本文介绍了{PHP} 致命错误:不在对象上下文中使用 $this (Joomla)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我真的不懂 php 并且碰壁了.

                i don't really know php and have hit a brick wall.

                问题是我的网站显示以下错误...

                The problem is that my site is showing the following error...

                Fatal error: Using $this when not in object context in /hermes/web07/b2350/pow.thefoodie/htdocs/index.php on line 11
                

                这是我的 index.php 文件的开头...

                This is the begining of my index.php file...

                <?php 
                /*
                  Joomla templates by Joomladesigns.co.uk
                 */
                
                // no direct access
                 define( 'YOURBASEPATH', dirname(__FILE__) );
                ?>
                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" >
                <head>
                <jdoc:include type="head" />
                <!--[if lte IE 6]>
                <style type="text/css">
                #main_body ul li { behavior: url(<?php echo $this->baseurl; ?>/templates/<?php echo $this->template ?>/css/iepngfix.htc) }
                </style>
                <script defer type="text/javascript" src="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template ?>/js/pngfix.js"></script>
                <![endif]-->
                <link href="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template ?>/css/template_css.css" rel="stylesheet" type="text/css" media="all" />
                <script type="text/javascript" src="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template ?>/js/fx_styles.js"></script>
                <script type="text/javascript" src="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template ?>/js/accordion.js"></script>
                
                <?php
                
                 // *************************************************
                 //
                 // Template Parameters
                 //
                 // *************************************************
                
                 $h1         = $this->params->get("logo");
                 $linked_h1    = ($this->params->get("logoLinked", 1)  == 0)?"false":"true";
                 $h1_title    = $this->params->get("logoTitle"); 
                 $h2_motto  = $this->params->get("logoMotto");
                
                 // Please do NOT change this unless you know what you doing.
                
                 $template_path = $this->baseurl.'/templates/'.$this->template; // template path
                
                 $default_font = "default";
                
                
                 // **************************************************
                
                ?>
                
                </head>
                

                任何帮助都会很棒,因为我完全迷失了.

                Any help would be great as i am completely lost.

                推荐答案

                好吧,您只能在类中使用 $this.在类之外,$this 不应该存在.它基本上引用了您在其中工作的当前类对象.要使其正常工作,您需要将一个变量定义为一个新类,然后通过该变量引用所有内容,例如:

                Well you can only use $this inside of a class. Outside of a class, $this shouldn't exist. It basically references the current class object that you're working inside of. To get this working properly, you need to define a variable as a new class and then reference everything through that variable, such as:

                $myvar = new MyClass();
                $h1 = $myvar->params->get("logo");
                

                如果那是你正在做的事情.

                If that's the kind of thing you're doing.

                这篇关于{PHP} 致命错误:不在对象上下文中使用 $this (Joomla)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Is Joomla 2.5 much faster than Joomla 1.5 Querywise(Joomla 2.5 比 Joomla 1.5 Querywise 快得多吗)
                How to share Joomla login session from one joomla website to one ASP.Net MVC website(如何将 Joomla 登录会话从一个 joomla 网站共享到一个 ASP.Net MVC 网站)
                htaccess redirect root to subdirectory but allow index.php in root AND query strings to function(htaccess 将根重定向到子目录,但允许根和查询字符串中的 index.php 起作用)
                Joomla include database functions(Joomla 包含数据库功能)
                nl2br() not working when displaying SQL results(显示 SQL 结果时 nl2br() 不起作用)
                Joomla 2.5 JFactory::getSession(); seems to be caching in firefox(Joomla 2.5 JFactory::getSession();似乎在 Firefox 中缓存)

                  <small id='OKynA'></small><noframes id='OKynA'>

                      <bdo id='OKynA'></bdo><ul id='OKynA'></ul>

                    • <legend id='OKynA'><style id='OKynA'><dir id='OKynA'><q id='OKynA'></q></dir></style></legend>

                          <i id='OKynA'><tr id='OKynA'><dt id='OKynA'><q id='OKynA'><span id='OKynA'><b id='OKynA'><form id='OKynA'><ins id='OKynA'></ins><ul id='OKynA'></ul><sub id='OKynA'></sub></form><legend id='OKynA'></legend><bdo id='OKynA'><pre id='OKynA'><center id='OKynA'></center></pre></bdo></b><th id='OKynA'></th></span></q></dt></tr></i><div id='OKynA'><tfoot id='OKynA'></tfoot><dl id='OKynA'><fieldset id='OKynA'></fieldset></dl></div>
                          <tfoot id='OKynA'></tfoot>

                            <tbody id='OKynA'></tbody>