字段'cats'是来自Angular app的选择框,包含来自table cats的数据,id,name和module_id.
功能在Slim框架上添加项目..
function addItem($section) {
$request = \Slim\Slim::getInstance()->request();
$item = json_decode($request->getBody());
$sql = "INSERT INTO " .$section. " (title, subtitle, slug, excerpt, originalDate, content, cats, published) VALUES (:title, :subtitle, :slug, :excerpt, :originalDate, :content, :cats, :published)";
try {
$db = getConnection();
$stmt = $db->prepare($sql);
$stmt->bindParam("title", $item->title);
$stmt->bindParam("subtitle", $item->subtitle);
$stmt->bindParam("slug", $item->slug);
$stmt->bindParam("excerpt", $item->excerpt);
$stmt->bindParam("originalDate", $item->originalDate);
$stmt->bindParam("content", $item->content);
$stmt->bindParam("cats", $item->cats);
$stmt->bindParam("published", $item->published);
$stmt->execute();
$item->id = $db->lastInsertId();
$db = null;
print_r(json_encode($item));
}
catch(PDOException $e) {
echo '{"error":{"text":'. $e->getMessage() .'}}';
}
}
Run Code Online (Sandbox Code Playgroud)
角度代码,用于选择框 …
我正在尝试搜索带有id的项目,但是我收到了此消息.所有功能都正常工作.执行时我收到此错误:
使用Firebase中的数组索引存储数据可能会导致意外行为.有关 详细信息,请参阅 https://www.firebase.com/docs/web/guide/understanding-data.html#section-arrays-in-firebase.
我的工厂
.factory('TEST', function ($firebaseArray) {
var ref = new Firebase('https://shark-firebase.firebaseio.com');
return {
all: function(section) {
var data = $firebaseArray(ref.child(section));
return data;
},
get: function(section, id) {
var data = $firebaseArray(ref.child(section).child(id));
return data;
}
};
});
Run Code Online (Sandbox Code Playgroud)
我一起试试:
get: function(section, id) {
var data = $firebaseArray(ref.child(section));
return data.$getRecord(id);
}
Run Code Online (Sandbox Code Playgroud)
和我的控制器:
如果是,$ stateParams.section ='posts'和$ stateParams.id ='0'.
$scope.loadItem = function(){
$scope.item = TEST.get($stateParams.section, $stateParams.id);
};
Run Code Online (Sandbox Code Playgroud) 我想悬停在a.bio改变背景.pic为绿色.
我尝试了一些方法,但没有成功.
我不理解它的逻辑~ 以及如何使其工作.
码
.executivo .pic::after {
background-color: #00845b;
content: "";
height: 100%;
left: 0;
position: absolute;
top: 0;
width: 100%;
opacity: 0;
transition: .3s ease-in-out;
}
.equipe a.bio:hover ~ .pic::after {
opacity: 0.35;
}
.executivo .pic {
margin-bottom: 45px;
position: relative;
}
.executivo .pic img {
display: block;
}Run Code Online (Sandbox Code Playgroud)
<div class="executivo">
<div class="pic">
<img src="<?php echo $pic; ?>" alt="<?php echo $nome; ?>" />
</div>
<div class="title">
<h3><?php echo $nome; ?></h3>
</div>
<a class="bio" …Run Code Online (Sandbox Code Playgroud)