我真的被这个问题吓坏了,它开始推迟我项目的其余部分,这真的让我很沮丧。
要点是它只向我显示通知错误和错误日志文件中的 404 错误不在屏幕上,其他通知错误显示在屏幕上。
为什么 codeigniter 会在应用程序/日志中显示错误,例如:
ERROR - 2015-04-18 12:03:24 --> 404 Page Not Found --> uploaded_img
ERROR - 2015-04-18 12:03:24 --> 404 Page Not Found --> images
ERROR - 2015-04-18 12:03:24 --> 404 Page Not Found --> images
// Above all three errors are shows only when i visit home page of my website and I am not calling any type of images class
ERROR - 2015-04-18 11:30:14 --> Severity: Notice --> Trying to get property of non-object D:\wamp\www\mywebsite\application\views\product_detail.php 2
ERROR - 2015-04-18 11:30:14 --> Severity: Notice --> Trying to get property of non-object D:\wamp\www\mywebsite\application\views\product_detail.php 3
ERROR - 2015-04-18 11:30:14 --> Severity: Notice --> Trying to get property of non-object D:\wamp\www\mywebsite\application\views\product_detail.php 4
// Above all three errors are shown when i view product_detail.php page of my website.
我的 index.php 设置在:
error_reporting(E_ALL | E_STRICT)
和配置:
$config['log_threshold'] = 1;
这是我的产品 Controller 类代码:
class Product extends Frontend_Controller{
public function __construct(){
parent::__construct();
$this->load->model('product_m');
$this->load->library('cart');
}
public function index($str){
// fetch the article
$this->data['product_info'] = $this->product_m->get_product_detail($str);
// creating breadcrumb navigation path
$this->data['main_category'] = $this->uri->segment(1);
$this->data['sub_category'] = $this->uri->segment(2);
$this->data['current_location'] = str_replace('-', ' ',str_replace('.html', '', $this->uri->segment(3)));
// load view
$this->load->view('product_detail',$this->data);
}
当我做var_dump($this->data['product_info']);
object(stdClass)[18]
public 'id' => string '24' (length=2)
public 'parent_category' => string 'sweets' (length=6)
public 'child_category' => string 'chikki-sweets' (length=13)
public 'product_url' => string 'chikki-bom-bom.html' (length=19)
public 'product_name' => string 'Chikki Bom Bom' (length=14)
public 'product_desc' => string '<span style="font-weight: bold; font-size: 24px; font-family: Sans;">Chikki Bom Bom </span><span style="font-weight: bold; font-size: 24px; font-family: Verdana;">Chikki</span><span style="font-weight: bold; font-size: 24px; font-family: Sans;"> </span><span style="font-weight: bold; font-size: 24px; font-family: 'Comic Sans MS';">Bom Bom.</span><div><span style="font-family: 'Comic Sans MS'; font-size: 24px; font-weight: bold; line-height: 34.2857170104981px;"><br></span></div><div><pre><span style="font-f'... (length=1161)
public 'product_sku' => string '123456789012' (length=12)
public 'quantity' => string '23' (length=2)
public 'price' => string '400.00' (length=6)
public 'offer_price' => string '100.00' (length=6)
public 'product_date' => string '2015-03-13' (length=10)
public 'img_url_1' => string 'http://localhost/my_website/uploaded_img/chiki-boom-boom_1.png' (length=63)
public 'img_url_2' => string 'http://localhost/my_website/uploaded_img/chikki_baadam_1.jpg' (length=61)
public 'img_url_3' => string 'http://localhost/my_website/uploaded_img/white-rasbhari_1.jpg' (length=62)
public 'img_url_4' => string 'http://localhost/my_website/uploaded_img/rasgulla_1.jpg' (length=56)
public 'img_url_5' => null
这是我的 product_detail.php 代码,其中显示错误:
$total_product = (int) $product_info->quantity; // line number 2
$mrp_price = (int) $product_info->price; // line number 3
$offer_price = (int) $product_info->offer_price; // line number 4
这里我在 product_detail.php 页面上做了var_dump($product_info);:
object(stdClass)[18]
public 'id' => string '24' (length=2)
public 'parent_category' => string 'sweets' (length=6)
public 'child_category' => string 'chikki-sweets' (length=13)
public 'product_url' => string 'chikki-bom-bom.html' (length=19)
public 'product_name' => string 'Chikki Bom Bom' (length=14)
public 'product_desc' => string '<span style="font-weight: bold; font-size: 24px; font-family: Sans;">Chikki Bom Bom </span><span style="font-weight: bold; font-size: 24px; font-family: Verdana;">Chikki</span><span style="font-weight: bold; font-size: 24px; font-family: Sans;"> </span><span style="font-weight: bold; font-size: 24px; font-family: 'Comic Sans MS';">Bom Bom.</span><div><span style="font-family: 'Comic Sans MS'; font-size: 24px; font-weight: bold; line-height: 34.2857170104981px;"><br></span></div><div><pre><span style="font-f'... (length=1161)
public 'product_sku' => string '123456789012' (length=12)
public 'quantity' => string '23' (length=2)
public 'price' => string '400.00' (length=6)
public 'offer_price' => string '100.00' (length=6)
public 'product_date' => string '2015-03-13' (length=10)
public 'img_url_1' => string 'http://localhost/my_website/uploaded_img/chiki-boom-boom_1.png' (length=63)
public 'img_url_2' => string 'http://localhost/my_website/uploaded_img/chikki_baadam_1.jpg' (length=61)
public 'img_url_3' => string 'http://localhost/my_website/uploaded_img/white-rasbhari_1.jpg' (length=62)
public 'img_url_4' => string 'http://localhost/my_website/uploaded_img/rasgulla_1.jpg' (length=56)
public 'img_url_5' => null
我应该怎么做才能消除这些错误?
最佳答案
删除 semi colon 是一个语法错误。设置
$config['log_threshold'] = 0;
关于php - codeigniter 错误日志文件仅显示通知错误但错误消息未显示在屏幕上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29716273/
我有一个Ruby程序,它使用rubyzip压缩XML文件的目录树。gem。我的问题是文件开始变得很重,我想提高压缩级别,因为压缩时间不是问题。我在rubyzipdocumentation中找不到一种为创建的ZIP文件指定压缩级别的方法。有人知道如何更改此设置吗?是否有另一个允许指定压缩级别的Ruby库? 最佳答案 这是我通过查看rubyzip内部创建的代码。level=Zlib::BEST_COMPRESSIONZip::ZipOutputStream.open(zip_file)do|zip|Dir.glob("**/*")d
我试图在一个项目中使用rake,如果我把所有东西都放到Rakefile中,它会很大并且很难读取/找到东西,所以我试着将每个命名空间放在lib/rake中它自己的文件中,我添加了这个到我的rake文件的顶部:Dir['#{File.dirname(__FILE__)}/lib/rake/*.rake'].map{|f|requiref}它加载文件没问题,但没有任务。我现在只有一个.rake文件作为测试,名为“servers.rake”,它看起来像这样:namespace:serverdotask:testdoputs"test"endend所以当我运行rakeserver:testid时
我的目标是转换表单输入,例如“100兆字节”或“1GB”,并将其转换为我可以存储在数据库中的文件大小(以千字节为单位)。目前,我有这个:defquota_convert@regex=/([0-9]+)(.*)s/@sizes=%w{kilobytemegabytegigabyte}m=self.quota.match(@regex)if@sizes.include?m[2]eval("self.quota=#{m[1]}.#{m[2]}")endend这有效,但前提是输入是倍数(“gigabytes”,而不是“gigabyte”)并且由于使用了eval看起来疯狂不安全。所以,功能正常,
Rails2.3可以选择随时使用RouteSet#add_configuration_file添加更多路由。是否可以在Rails3项目中做同样的事情? 最佳答案 在config/application.rb中:config.paths.config.routes在Rails3.2(也可能是Rails3.1)中,使用:config.paths["config/routes"] 关于ruby-on-rails-Rails3中的多个路由文件,我们在StackOverflow上找到一个类似的问题
对于具有离线功能的智能手机应用程序,我正在为Xml文件创建单向文本同步。我希望我的服务器将增量/差异(例如GNU差异补丁)发送到目标设备。这是计划:Time=0Server:hasversion_1ofXmlfile(~800kiB)Client:hasversion_1ofXmlfile(~800kiB)Time=1Server:hasversion_1andversion_2ofXmlfile(each~800kiB)computesdeltaoftheseversions(=patch)(~10kiB)sendspatchtoClient(~10kiBtransferred)Cl
我得到了一个包含嵌套链接的表单。编辑时链接字段为空的问题。这是我的表格:Editingkategori{:action=>'update',:id=>@konkurrancer.id})do|f|%>'Trackingurl',:style=>'width:500;'%>'Editkonkurrence'%>|我的konkurrencer模型:has_one:link我的链接模型:classLink我的konkurrancer编辑操作:defedit@konkurrancer=Konkurrancer.find(params[:id])@konkurrancer.link_attrib
大约一年前,我决定确保每个包含非唯一文本的Flash通知都将从模块中的方法中获取文本。我这样做的最初原因是为了避免一遍又一遍地输入相同的字符串。如果我想更改措辞,我可以在一个地方轻松完成,而且一遍又一遍地重复同一件事而出现拼写错误的可能性也会降低。我最终得到的是这样的:moduleMessagesdefformat_error_messages(errors)errors.map{|attribute,message|"Error:#{attribute.to_s.titleize}#{message}."}enddeferror_message_could_not_find(obje
我正在寻找执行以下操作的正确语法(在Perl、Shell或Ruby中):#variabletoaccessthedatalinesappendedasafileEND_OF_SCRIPT_MARKERrawdatastartshereanditcontinues. 最佳答案 Perl用__DATA__做这个:#!/usr/bin/perlusestrict;usewarnings;while(){print;}__DATA__Texttoprintgoeshere 关于ruby-如何将脚
我主要使用Ruby来执行此操作,但到目前为止我的攻击计划如下:使用gemsrdf、rdf-rdfa和rdf-microdata或mida来解析给定任何URI的数据。我认为最好映射到像schema.org这样的统一模式,例如使用这个yaml文件,它试图描述数据词汇表和opengraph到schema.org之间的转换:#SchemaXtoschema.orgconversion#data-vocabularyDV:name:namestreet-address:streetAddressregion:addressRegionlocality:addressLocalityphoto:i
使用带有Rails插件的vim,您可以创建一个迁移文件,然后一次性打开该文件吗?textmate也可以这样吗? 最佳答案 你可以使用rails.vim然后做类似的事情::Rgeneratemigratonadd_foo_to_bar插件将打开迁移生成的文件,这正是您想要的。我不能代表textmate。 关于ruby-使用VimRails,您可以创建一个新的迁移文件并一次性打开它吗?,我们在StackOverflow上找到一个类似的问题: https://sta