Loading...
Non-static method appmodelsactiveItems::findItem() cannot be called statically
php
<?php

namespace appmodelsactive;

use yiidbActiveRecord;

class Items extends ActiveRecord
{

public function findItem($user_id, $type) {
$item = static::findOne(['user_id' => $user_id, 'type' => $type]);
if (empty($item)) {
return (object)[
'user_id' => $user_id,
'type' => $type,
'level' => 0,
'param' => 0
];
} else {
return $item;
}
}
}
?>

________
посл. ред. 29.05.2022 в 21:21; всего 1 раз(а); by Ржавый
исправил так.sarcasmic.
php
public static function
что тут неправельно
php
<?php if ($user->id != $_GET['id']) : ?>
<div class="small"
style="position:absolute; top: 0; right: 0"><span
style="padding: 2px 4px; width: 100px; display: inline-block; background-color: #2b577f; color: #ffffff;"
class="center" id="id3197"><?php echo User:: Achievements($user->id, 1); ?>/25000 </span></div>
<?php endif; ?>
Deleted

Изображение

------
82133_20220529_1804.png (8.6 Kb)
Скачиваний: 102

________
посл. ред. 21.08.2022 в 12:30; всего 1 раз(а); by REWERK
REWERK (29.05.2022 в 18:02)
Возможно это двоеточие лишнее. А так, на будущее - текст ошибки прилагай

С двоеточием все норм
а вот пробел после User:: кажется лишним
galtsev.t, какой
Серега (29.05.2022 в 18:38)
galtsev.t, какой

User::Achievements
php
static::findOne(['user_id'
здесь ошибка
Онлайн: 2
Время:
Gen. 0.1172
(c) Bym.Guru 2010-2025