注意:尝试获取非对象调试错误的属性(Notice: Trying to get property of non-object debug error)
当404页面被触发时,我得到一个
注意:尝试获取非对象的属性
在调试模式下,在以下代码行中
$custom = get_post_custom($post->ID);
和
$parent_id = $parent_id_2 = $post->post_parent;
我知道这是因为404页面被触发因为首先没有要显示的帖子。 为了摆脱这些通知,我需要先检查一下,看看是否有要发布的帖子。 我的问题是,我该怎么做。 有什么建议?
When the 404 page is triggered, I get a
Notice: Trying to get property of non-object
on the following lines of code when in debug mode
$custom = get_post_custom($post->ID);
and
$parent_id = $parent_id_2 = $post->post_parent;
I know this is suppose to happen because the 404 page triggers because the are no post to show in the first place. To get rid of these notices I need to do a check first to see if there is a post to show. My problem is, exactly how do I do it. Any suggestions?
原文:https://stackoverflow.com/questions/21291471
最满意答案
不,我不认为Bindy有这种支持,但是beanio和camel-beanio都支持在字段中添加正则表达式。 因此,您可以使用正则表达式来限制值。 http://beanio.org/
No I don't think Bindy has that supported, but beanio and hence camel-beanio supports adding regex to a field. So you can use regex to restrict values. http://beanio.org/
相关问答
更多-
Apache Camel Bindy - 我可以为字段定制数据类型吗?(Apache Camel Bindy - can I have a customized data-type for a field?)[2022-04-22]
不,我不认为Bindy有这种支持,但是beanio和camel-beanio都支持在字段中添加正则表达式。 因此,您可以使用正则表达式来限制值。 http://beanio.org/ No I don't think Bindy has that supported, but beanio and hence camel-beanio supports adding regex to a field. So you can use regex to restrict values. http://beani ... -
camel-bindy同一个包中的多个模型不是woking(camel-bindy Multiple models in the same package is not woking)[2023-06-28]
原因可能正是这两个类在同一个包中。 尝试将一个移到另一个包+看看克劳斯易卜生的评论 。 The reason might be exactly that, the two classes in the same package. Try moving one to another package + see comment from Claus Ibsen. -
我如何使用带有apache camel的elasticsearch 2.2.1(how can i use elasticsearch 2.2.1 with apache camel)[2021-11-21]
我自己就遇到了这个问题。 不幸的是,camel 2.16.x不支持elasticsearch> = 2.0 但是,我可以确认camel 2.17.0似乎与elasticsearch 2.3.1一起使用。 骆驼发行说明表明camel 2.17.0现在支持elasticsearch 2.0。 Elasticsearch从1.7.3到2.0.0 I hit this exact problem myself. Unfortunately, camel 2.16.x does not support elastic ... -
你想要做的不是特定于bindy。 这是一个常见的问题,你需要通过Spring DI注入一个Class的“值”。 这是一个描述如何正确传递类参数的链接: 通过Spring Config将“HardCoded”构造函数Arg Class
传递给bean What you are trying to do is not specific to bindy. It's a common problem where you need to inject the "value" of a Class via Sp ... -
Camel Bindy:@DataField中的可配置“pos”属性(Camel Bindy : configurable “pos” attribute in @DataField)[2024-02-09]
不,这是不可能的。 并且没有计划在未来支持这一点。 您可以查看一些其他CSV组件,例如beanio,它允许在外部配置文件中定义绑定信息。 http://camel.apache.org/beanio http://camel.apache.org/data-format.html No this is not possible. And there is no plans to support this in the future. You can take a look at some of the ot ... -
Camel Bindy应用程序JBoss EAP 6.1部署问题(Camel Bindy application JBoss EAP 6.1 Deployment issue)[2022-07-04]
听起来你可能正在使用JBoss FSW? EAP 6.3上的Fuse 6.3包括camel-bindy,如果你可以升级,还有SwitchYard的例子。 After refering the link https://developer.jboss.org/thread/177124.I have added the manifest entry in maven jar plugin pom xml你可以像使用路由一样使用bean组件,你可以在beanRef中使用它。 bean组件的文档: http : //camel.apache.org/bean.html 所以camel:bean和camel:to都是为了调用一个bean。 在这种情况下,在你的第一次调用中你已经指定了要调用的方法,但在第二次调用中你没有指定要调用的方法的名字,所以Camel会使用下面的规则选择方法(在你的情况下,方法用@Handler装饰): http : //camel.apache.org/bean-binding.html ...无法按照Camel文档 (“使用方法调用作为收件人列表”部分)中的说明混合@RecipientList和recipientList() )。 因此,只需使用一个或另一个。 1.使用recipientList() 从方法中删除@RecipientList : // No @RecipientList annotation public String[] recipents() { return new String[] { MOCK1, MOCK2 }; } 并按如下方式定义路线: from("di ...我实际上不认为这是可能的开箱即用? 因为您需要一种方法(鉴别器)来确定行是标题还是细节。 这不是我们现在得到的功能。 您可以拆分数据,因此只有一个标题+详细信息。 但这需要在Camel中拥有多条消息。 但是,您的结构似乎相当简单。 所以只需使用一些好的老式Java代码就可以了。 然而,Apache Camel项目喜欢贡献,所以随意打开这个用例的JIRA票,然后添加一个识别功能将是一个很好的补充。 然后,处理因类型不同而不同的CSV记录也会更容易一些。 http://camel.apache.org/cont ...在这种情况下,我认为最好将处理分为两个部分。 接收不同数据的主要路径。 在这里,您可以定义谓词规则,以确定它是什么类型的主体。 检查身体的开始,或确定它属于这种类型的东西。 添加一个choice()when()并根据哪个谓词设置为true将其设置为单独的路由。 在辅助路线中添加特定的绑定格式并执行您的编组/解组工作。 文档中的一个示例: Predicate isWidget = header("type").isEqualTo("widget"); from("jms:queue:order") .c ...相关文章
更多- Lua Debug调试
- could not find system property or JNDI
- MyEclipse用Debug调试不了
- 如何对Hadoop作业的某个task进行debug单步跟踪
- mybatis There is no getter for property named 'xx' in 'class java.lang.String
- eclipse里报:An internal error occurred during:
- Hadoop 异常记录 ERROR: org.apache.hadoop.hbase.MasterNotRunningException: Retried 7 times
- 命令行运行Hbase: Session 0x0 for server null, unexpected error
- The connection to adb is down, and a severe error has occured.
- solr error logs org.apache.solr.common.SolrException: ERROR: [doc=17] unknown field alias
最新问答
更多- 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
- 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
- OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
- 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
- codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
- 在计算机拍照在哪里进入
- 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
- No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
- 单页应用程序:页面重新加载(Single Page Application: page reload)
- 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
- System.StackOverflow错误(System.StackOverflow error)
- KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
- 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
- android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
- TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
- 企业安全培训的各项内容
- 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
- C#类名中允许哪些字符?(What characters are allowed in C# class name?)
- NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
- 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
- 将多个行和可变行移动到列(moving multiple and variable rows to columns)
- 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
- 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
- Angular $资源不会改变方法(Angular $resource doesn't change method)
- 在Angular 5中不是一个函数(is not a function in Angular 5)
- 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
- 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
- 常见的python rpc和cli接口(Common python rpc and cli interface)
- Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
- 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)