Php 如何通过Craft CMS中的特定属性访问条目?
我正在寻找一种编程方式,使用Craft CMS 3在PHP中通过属性访问条目 以下是我到目前为止的情况:Php 如何通过Craft CMS中的特定属性访问条目?,php,craftcms,Php,Craftcms,我正在寻找一种编程方式,使用Craft CMS 3在PHP中通过属性访问条目 以下是我到目前为止的情况: Craft::$app->getEntries()->getEntryById('1234'); getEntryById()似乎是getEntries()中唯一可用的方法 我想做什么(在伪代码中): 您可以按字段值查询条目,如下所示: \craft\elements\Entry::find()->section('mySection')->where(['fiel
Craft::$app->getEntries()->getEntryById('1234');
getEntryById()
似乎是getEntries()
中唯一可用的方法
我想做什么(在伪代码中):
您可以按字段值查询条目,如下所示:
\craft\elements\Entry::find()->section('mySection')->where(['field_myFieldHandle' => $myValue])->one();
\craft\elements\Entry::find()->section('mySection')->where(['field_myFieldHandle' => $myValue])->one();