Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/290.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何通过Craft CMS中的特定属性访问条目?_Php_Craftcms - Fatal编程技术网

Php 如何通过Craft CMS中的特定属性访问条目?

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 CMS 3在PHP中通过属性访问条目

以下是我到目前为止的情况:

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();