小编Ana*_*mov的帖子

如何更改 mysql 中浮点值的精度?

你好,在我的数据库中,我有一列包含诸如 6.251543423 之类的数字,我想让它们像 6.25 一样而不进行四舍五入。

我已经尝试过update examresults set point = substring(point,0,5),但它返回所有值为零

mysql sql sql-update

3
推荐指数
1
解决办法
2万
查看次数

Laravel 4 上具有相同供应商文件夹的多个项目

我有多个项目,空间很小。

因为它们中的大多数使用几乎相同的包(只有 1 个使用 phpexcel ,另一个使用 swiftmailer ),并且供应商文件夹在 Laravel 上需要最大的空间。

我想也许我可以为每个人使用相同的供应商文件夹。

我实际上搞砸了 autoload.php 和其他一些配置文件,但我无法做到。

只是我将供应商文件夹放在 public_html 下并创建像 project1 project2 这样的文件夹。在这些文件夹下,我将把我的项目的所有内容都放在供应商文件夹下,然后将它们设为子域。

laravel laravel-4

2
推荐指数
1
解决办法
1962
查看次数

如何在eloquent中用零检索数据

我正在通过从数据库中检索多个数据来创建学生编号.

喜欢Course_ID.Year_Code.Student_no

为了检索相同的数字,我将我的原始学生编号(在创建时给出)填写为0001,0002.

当我尝试通过从数据库中获取此号码来检索我的学号

我得到没有零的结果.

让我们说 Course_ID 22Year_Code 16

Student_NO 0005

我将号码返回22165,应该是22160005.这就是我学生的方式.

$students = \App\Student::with('payment')->where('branch', $id)->get();
Run Code Online (Sandbox Code Playgroud)

(我实际上收到的student_no没有零,下面的查询)

这就是我用刀片写的方式

<td>{{$student->Course_ID.$student->course->year_code.$student->student_no}}  </td>
Run Code Online (Sandbox Code Playgroud)

PS:我知道如何使用str_pad检索本机php的数字.我问是否有一种方法可以在Eloquent上进行.

php mysql laravel eloquent laravel-5

2
推荐指数
1
解决办法
2186
查看次数

Onclick确认,然后重定向

我正在尝试确认然后重定向到新页面。

如果我returnconfirm确认任何一种方法之前都删除了它,但是如果我保留return它,则不会重定向到链接。

<button name="payment" class="btn btn-xs-6 btn-danger btn-block" type="button"
    onclick="return confirm('are you sure you want to cancel?');window.location.href='cancel';"
    value="fav_HTML">Cancel Payment
</button>
Run Code Online (Sandbox Code Playgroud)

html javascript html5 onclick

1
推荐指数
1
解决办法
1796
查看次数

中心左对齐按钮的文本

即使我制作重力中心文字仍然在左边.我假设必须有一个方法来改变文本对齐(我已经尝试过android:textAlignment ="center")

我在下面列出了截图,但没有足够的声誉来展示它.

<!-- language: lang-xml-->    
<Button
                android:id="@+id/button1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="50"
                android:gravity="center"
                android:text="Button" />
Run Code Online (Sandbox Code Playgroud)

还试图让match_parent仍然是同样的问题.

编辑整个XML

<!-- language: lang-xml-->
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <EditText
        android:id="@+id/etCommands"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:hint="Type a Command"
        android:password="true" >
    </EditText>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:weightSum="100" >

        <Button
            android:id="@+id/button1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="Button" />
    </LinearLayout>

    <TextView
        android:id="@+id/tvResults"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="invalid" />

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

截图

android text-align button

0
推荐指数
1
解决办法
1万
查看次数