本文整理汇总了PHP中Track::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Track::find方法的具体用法?PHP Track::find怎么用?PHP Track::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Track
的用法示例。
在下文中一共展示了Track::find方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
<script type="text/javascript">
$(document).ready(function(){
});
</script>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<link rel="stylesheet" href="bootstrap-select.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script src="bootstrap-select.js"></script>
<?php
include 'models.php';
$track = isset($_GET['id']) ? Track::find($_GET['id']) : Track::create(null, null, 0, 0, 0, 1);
?>
</head>
<body>
<div class="jumbotron" >
<div class="container"><?php
if (isset($track->TrackId)) {
?>
<h1>Track</h1>
<?php
} else {
?>
示例2: intval
<?php
include 'models.php';
if (isset($_POST['id'])) {
$a = Track::find($_POST['id']);
$a->Name = $_POST['name'];
$a->Album = intval($_POST['album']);
$a->Composer = $_POST['composer'];
$a->Milliseconds = $_POST['milliseconds'];
$a->Bytes = $_POST['bytes'];
$a->UnitPrice = $_POST['unitprice'];
if ($a->save()) {
header("Location: " . "../index.php?id=" . $a->TrackId);
}
} else {
$a = Track::create($_POST['name'], $_POST['composer'], $_POST['milliseconds'], $_POST['bytes'], $_POST['unitprice'], intval($_POST['album']));
if ($a->save()) {
header("Location: " . "../index.php?id=" . $a->TrackId);
}
}
示例3: header
<?php
include 'models.php';
if (isset($_GET['id'])) {
$a = Track::find($_GET['id']);
if ($a->delete()) {
header("Location: index.php");
}
} else {
header("Location: index.php");
}
示例4: api_get_track_by_id
public function api_get_track_by_id($track_id)
{
$track = Track::find($track_id);
$data = array('id' => $track_id, 'name' => $track->name, 'artist_name' => $track->artist->name, 'album_name' => $track->album->name);
return Response::json($data);
}