最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - Using custom field content as expression in IF statement

programmeradmin3浏览0评论
Closed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 6 years ago.

Improve this question

I want to store some conditional logic in custom post types , and then use these in a plugin to generate new content based on the logic.

Eg if a user submits a form with “body temperature”, a conditional logic will tell the user if she has a fever or not, and some extra text.

There will be many such logic elements and I would like to maintain them from the front end.

I was thinking about putting the above into two posts. One with condition field “temperature > 37” and text “you have a fever”. Then in a plugin loop through logic records, take the conditional field and use it as the expression in an if statement.

How to make this work?

Closed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 6 years ago.

Improve this question

I want to store some conditional logic in custom post types , and then use these in a plugin to generate new content based on the logic.

Eg if a user submits a form with “body temperature”, a conditional logic will tell the user if she has a fever or not, and some extra text.

There will be many such logic elements and I would like to maintain them from the front end.

I was thinking about putting the above into two posts. One with condition field “temperature > 37” and text “you have a fever”. Then in a plugin loop through logic records, take the conditional field and use it as the expression in an if statement.

How to make this work?

Share Improve this question asked Apr 4, 2019 at 6:04 KCarterKCarter 113 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I asked the question in another group and here I got an answer that has turned out to be useful.

BE AWARE! It must be dealt with with caution as the PHP eval() function can be a significant security risk.

Find the answer here: https://stackoverflow/a/55518496/11309498

发布评论

评论列表(0)

  1. 暂无评论