我需要按照getNotifications函数中值'start_date'的DESC顺序对通知数组进行排序:
$posts_id_arr = getPoststIds($conn);
foreach ($posts_id_arr as $key => $val) {
$total_arr[$key] = [
'notification' => getNotifications($val['post_id'], $user_id, $conn)
];
}
$response_array = array('data' => $total_arr, 'more things' => $more_array);
echo json_encode($response_array);
Run Code Online (Sandbox Code Playgroud)
现在,由于foreach循环,订单是通过邮递ID进行的。
data {
notification:
[
{
post_id: “1",
start_date: "2016-10-10 08:00:00",
},
{
post_id: “1",
start_date: "2016-10-10 12:00:00",
}
],
notification:
[
post_id: “2",
start_date: "2016-10-10 09:00:00",
},
{
post_id: “2",
start_date: "2016-10-10 13:00:00",
}
]
}
Run Code Online (Sandbox Code Playgroud)
我需要是1:08:00,2:09:00,1:12:00,2:13:00
我有一个gridview中的图库,显示数据库中的图片.
我需要在水平布局中显示gridview.
现在,图片从上到下排列,如何更改网格视图,以便在一行中从左到右显示图片?
HTML代码:
<asp:GridView ID="GridView3" class="GridView1" runat="server" Width="400px" AutoGenerateColumns="False" Height="90px"
CellPadding="4" GridLines="Horizontal">
<Columns>
<asp:ImageField DataImageUrlField="Image_path" DataImageUrlFormatString="~/Pic/{0}" HeaderText="Images">
<ControlStyle Height="100px" Width="100px" />
</asp:ImageField>
</Columns>
</asp:GridView>
Run Code Online (Sandbox Code Playgroud)
c#代码:
con.Open();
cmd = new SqlCommand("select image_path from tblImages", con);
da = new SqlDataAdapter(cmd);
dt = new DataTable();
da.Fill(dt);
GridView3.DataSource = dt;
GridView3.DataBind();
Run Code Online (Sandbox Code Playgroud)
con.Close();
我正在使用React,当用户点击<li>
标签时,会弹出弹出方法,但是方法中的组件没有显示,弹出组件没有被触发,为什么会这样?
export default class Main extends React.Component {
constructor(props) {
super(props);
}
popup(value) {
console.log('fired ok');
//call popup component
<Popup value={value} />
}
render() {
return (
<ul>
<li key={0} onClick={() => this.popup(value)} />
</ul>
)
}
}
export default class Popup extends React.Component {
constructor(props) {
super(props);
}
render() {
console.log('this is not fired');
const { value } = this.props;
return (
<div class="popup">
<p>{value}</p>
</div>
)
}
}
Run Code Online (Sandbox Code Playgroud)