这是我的include.php:
<?php
class cars {
protected $_car;
public function __costruct($carName) {
$this->_car = $carName;
}
public function getcarname (){
return $this->_car;
}
}?>
Run Code Online (Sandbox Code Playgroud)
这是我的index.php
<?php
require_once 'include.php';
$selling = new cars('Ford');
echo $selling->getcarname();
?>
Run Code Online (Sandbox Code Playgroud)
还是回声没什么!你可以说我是新手上课,但我知道php,处理它有点复杂,而且我发现它不会浪费代码,反正仍然我想学习它,所以我的代码有什么问题?
我在stackoverflow上发现了一堆关于数组和列表没有绑定但是我只有一个简单的视图模型有4个字符串而且帖子没有给我表单值:
视图模型:
public class ReferralNetworkSearchCriteria
{
public string Email = "";
public string FirstName = "";
public string LastName = "";
public string TaxSSN = "";
}
Run Code Online (Sandbox Code Playgroud)
ReferralNetworkController:
public ActionResult Search()
{
ReferralNetworkSearchCriteria criteria = new ReferralNetworkSearchCriteria();
return View(criteria);
}
[HttpPost]
public ActionResult Search(ReferralNetworkSearchCriteria criteria)
{
return View(criteria);
}
Run Code Online (Sandbox Code Playgroud)
视图:
@using OurCompany.ViewModels
@model ReferralNetworkSearchCriteria
@{
ViewBag.Title = "Search Referral Network";
}
<h2>Search Referral Network</h2>
@using(Html.BeginForm("Search","ReferralNetwork",FormMethod.Post))
{
<fieldset>
<div class="row">
<div class="large-4 column">
<label>Email</label>
@Html.TextBox("Email")
</div>
<div class="large-4 column">
<label>
First …Run Code Online (Sandbox Code Playgroud) 当我在没有调试的情况下更改为运行时,我的绑定不包含html中的正确路径.它正在删除文件名.
using System.Web;
using System.Web.Optimization;
namespace Search
{
public class BundleConfig
{
// For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
public static void RegisterBundles(BundleCollection bundles)
{
bundles.UseCdn = true;
var jqueryuiCdnPath = "http://ajax.aspnetcdn.com/ajax/jquery.ui/1.10.3/jquery-ui.min.js";
var knockoutCdnPath = "http://ajax.aspnetcdn.com/ajax/knockout/knockout-2.2.1.js";
var modernizerCdnPath = "";
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js",
"~/Scripts/jquery.printPage.js"
));
bundles.Add(new ScriptBundle("~/bundles/jqueryui", jqueryuiCdnPath).Include(
"~/Scripts/jquery-ui-{version}.custom.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.unobtrusive*",
"~/Scripts/jquery.validate*"));
bundles.Add(new ScriptBundle("~/bundles/knockout", knockoutCdnPath).Include(
"~/Scripts/knockout-2.1.0.debug.js"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the …Run Code Online (Sandbox Code Playgroud) 我想@Html在我的视图中使用 帮助程序,但Visual Studio不知道我的项目是MVC4.我已经设定Using System.Web.Mvc
我在filteredAndApprovedQBCustomers'中运行客户客户列表循环,我使用服务来检查这个'客户'是否有customerInfo记录.
如果他们确实有customerInfo记录,但他们的'businessCategory'列未选中显示"No Business Category exists ..." ,请跳至下一个客户列表
如果他们确实有一个customerInfo记录,但是他们的'businessCategory'被选中并且在下面列出了JUMP TO NEXT CUSTOMER
如果他们没有customerInfo记录,请创建一个并显示"没有业务类别存在..."
我试图通过使用break从列表中跳出并返回显示的列表来跳转到列表中的下一个custan object of type convertibale System.Web.MVC.ActionResult is required
有任何想法吗?
我有约会时间:
string validDate = formCollection["ValidDate"];
Run Code Online (Sandbox Code Playgroud)
ValidDate值为:
06/24/2014
Run Code Online (Sandbox Code Playgroud)
如果我想转换validDate为ir.ValidDate我得到一个例外.
InterestRate ir = new InterestRate();
ir.ValidDate = Convert.ToDateTime(validDate);
Run Code Online (Sandbox Code Playgroud)
例外:
An exception of type 'System.FormatException' occurred in mscorlib.dll but was not handled in user code
Additional information: String was not recognized as a valid DateTime.
Run Code Online (Sandbox Code Playgroud)
我试过以下.但仍然有例外:
DateTime resultDate = DateTime.ParseExact(validDate , "dd/MM/yyyy", CultureInfo.InvariantCulture);
Run Code Online (Sandbox Code Playgroud)
我到底错过了什么?
我从Composer安装PHP laravel所以我创建了一个路由:
Route::get('cats/{id}', function()
{
return "Cat #$id";
});
Run Code Online (Sandbox Code Playgroud)
但是当我进入:http://www.oktech-servers.net/cats/12345
错误消息提示: Whoops, looks like something went wrong.
我还要提到htaccess:
RewriteEngine On
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
Run Code Online (Sandbox Code Playgroud)
我的主机管理员说mod-rewrite工作正常,但我找不到为什么我得到这个错误!
问候.
以下是从数据层获取数据的代码:-
我想以 Json 格式发送这 3 个列表。如何捆绑这是一个数组?
public JsonResult getDataAll()
{
List<Chart> data1 = dashboard.CountbyDep();
List<Chart> data2 = dashboard.CountbyDes();
List<Chart> data3 = dashboard.CountbyCat();
allData = // ??
return Json(allData, JsonRequestBehavior.AllowGet);
}
Run Code Online (Sandbox Code Playgroud)
如果我只发送data1它就会成功。如何发送3个列表?
我@event在控制器中有此变量,我想@event在所有视图中访问此变量。我不想将其设为全局变量。还有其他方法可以做到吗?我正在使用Rails 4.1。
我在 .cpp 文件中的每个函数原型和 fucntion 上收到此编译器错误(“CLASSNAME 未命名类型”)
.h 文件:
#ifndef MOVIETREE_HPP
#define MOVIETREE_HPP
struct MovieNode
{
...//members and such
};
class MovieTree
{
public:
MovieTree();
~MovieTree();
void printMovieInventory();
...//more functions
protected:
private:
void printMovieInventory(MovieNode * node);
MovieNode* search(std::string title);
MovieNode *root;
};
#endif // MOVIETREE_HPP
Run Code Online (Sandbox Code Playgroud)
.cpp 文件:
#ifndef MOVIETREE_HPP
#define MOVIETREE_HPP
#include <iostream>
#include <fstream>
#include <string>
#include <cstdlib>
#include "MovieTree.hpp"
using namespace std;
MovieTree::MovieTree(); //error code here and all prototypes and functions below
MovieTree::~MovieTree();
void MovieTree::printMovieInventory();
...//more function prototypes
MovieTree::MovieTree(){ …Run Code Online (Sandbox Code Playgroud)