我想找到一个字符串的一部分,如果true我想输出它找到的整个字符串.
以下是一个例子:
$Towns = "Eccleston, Aberdeen, Glasgow";
$Find = "Eccle";
if(strstr($Find, $Towns)){
echo outputWholeString($Find, $Towns); // Result: Eccleston.
}
Run Code Online (Sandbox Code Playgroud)
如果有人能够阐明如何做到这一点,并且记住它不会是静态值; 在$Towns和$Find变量将被动态地分配在我住的脚本.
我有两个模型需要关联,一个Users模型和一个Prices模型。在我的Prices模型中有一个JSON object持有ID用户的 ,我想知道我是否可以Prices使用模型中的ID哪个与我的表相关联Prices?
我知道你可以使用 angetAttribute然后像这样返回用户,但我想知道是否有$this->hasOne()你可以使用的方法?
例如
JSON
{user_id: 1, other_values:"in the object"}
价格模型
class Prices extends Model {
/* Prices has the column 'object' which has the JSON object above */
protected $casts = ['object' => 'array'];
public function user(){
return $this->hasOne("App\User", $this->object->user_id, "id"); /* ! Example ! */
}
}
Run Code Online (Sandbox Code Playgroud) 我在为游戏编写代码时遇到了一个问题.似乎我不能在语句中使用变量;
local Username = "Cranavvo"
game.Players.Username:BreakJoints() -- Kills the player
Run Code Online (Sandbox Code Playgroud)
输出告诉我"没有这样的用户''用户名'"应该是"Cranavvo".
试图找出样式选择框的问题.它被包裹在一个带背景的div中,以创建一个蒙版外观.
当输入中的文本太多时,它将溢出到按钮中.
HTML:
<div class="styled-select">
<select class="form-control required" name="address" disabled>
<option style="" value="">Please Select Address</option>
</select>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
.styled-select select {
font-family: "Circular", Helvetica, Arial, sans-serif;
font-size: 18px;
background: transparent;
width: 100%;
padding: 15px;
font-size: 16px;
line-height: 1;
border: 0;
height: 50px;
border-radius: 10px;
-webkit-appearance: none;
padding-right: 10%;
}
.styled-select {
width: 100%;
overflow: hidden;
background: url(../images/bg/down-arrow.jpg) no-repeat right #FFF;
background-size: 60px;
height: 50px;
border-radius: 10px;
}
@media (min-width: 768px) {
.styled-select select {
font-family: "Circular", Helvetica, Arial, sans-serif; …Run Code Online (Sandbox Code Playgroud) 有没有办法or die()在内置函数中创建函数时使用mysql_connect() or die("There was an error connecting to MySQL!")?