我有一个看起来像这样的函数:
require("config.php");
function displayGta()
{
(... lots of code...)
$car = $car_park[3];
}
Run Code Online (Sandbox Code Playgroud)
和一个看起来像这样的config.php:
<?php
$car_park = array ("Mercedes 540 K.", "Chevrolet Coupe.", "Chrysler Imperial.", "Ford Model T.", "Hudson Super.", "Packard Sedan.", "Pontiac Landau.", "Duryea.");
(...)
?>
Run Code Online (Sandbox Code Playgroud)
为什么我会收到通知:未定义的变量:car_park?
我有一点我不明白的问题.我有一个拥有所有者和类型的数据库(当然还有更多).我想得到一个列表,其中包含所有者等于当前用户的所有类型值,但我只得到两个结果
$sql = "SELECT type FROM cars WHERE owner='".mysql_real_escape_string($_SESSION['username'])."' AND selling='0' ORDER BY id DESC ";
$result = mysql_query($sql,$con);
print_r(mysql_fetch_array($result));
Run Code Online (Sandbox Code Playgroud)
打印出来:
Array ( [0] => 18 [type] => 18 )
Run Code Online (Sandbox Code Playgroud)
和
$sql = "SELECT type FROM cars WHERE owner='".mysql_real_escape_string($_SESSION['username'])."' AND selling='0' ";
Run Code Online (Sandbox Code Playgroud)
打印出来:
Array ( [0] => 16 [type] => 16 )
Run Code Online (Sandbox Code Playgroud)
结果应该是数组中的19,19,18,17,16.这就是我设置为所有者的所有类型.
我现在有这个工作:
for ($x = 0; $x < mysql_num_rows($result); $x++){
$row = mysql_fetch_assoc($result);
echo $row['type'];
}
Run Code Online (Sandbox Code Playgroud)
这里我正确地打印出所有值,但是我需要创建一个包含所有值的数组.我虽然可以使用array_push,但大多数都有更好的方法.我以为我会通过简单的mysql查询获得所有类型值.
我的单元测试类中有3个测试方法,但Visual Studio只运行第二个测试,忽略其他测试
这些是3种测试方法:
[TestClass()]
public class InsertionSortTest
{
[TestMethod()]
public void sortTest()
{
InsertionSort target = new InsertionSort(); // TODO: Initialize to an appropriate value
int[] n = new int[] { 2, 1, 4 };
int[] nExpected = new int[] { 1, 2, 4 };
target.sort(ref n);
CollectionAssert.AreEqual(nExpected, n);
}
[TestMethod()]
public void sortTest2()
{
InsertionSort target = new InsertionSort(); // TODO: Initialize to an appropriate value
int[] n = new int[] { 1, 2 };
int[] nExpected = new …Run Code Online (Sandbox Code Playgroud) 我试过像这样的html:
<form method="post">
<select id="select" size="2 ">
<option value="3">test</option>
<option value="4">test2</option>
</select>
<button type="submit" value="execute">
</form>
Run Code Online (Sandbox Code Playgroud)
如何在post数组中获得3或4的值
$_POST['select']
Run Code Online (Sandbox Code Playgroud)
?
我试图将我的应用程序的一部分分成一个指令,但继续得到这个:
Multiple directives [tree (module: anbud), tree (module: anbud)] asking for template on:
Run Code Online (Sandbox Code Playgroud)
这可能是由于:
Multiple directives requesting isolated scope.
Multiple directives publishing a controller under the same name.
Multiple directives declared with the transclusion option.
Multiple directives attempting to define a template or templateURL.
Run Code Online (Sandbox Code Playgroud)
我有一个看起来像这样的观点:
<tree></tree>
Run Code Online (Sandbox Code Playgroud)
该指令如下所示:
(function (module) {
var tree = function () {
return {
restrict: "E",
controller: "treeController",
templateUrl: "/app/NSviewer/templates/parts/tree.html"
};
};
module.directive("tree", tree);
}(angular.module("anbud")));
Run Code Online (Sandbox Code Playgroud)
我的控制器更复杂:
(function () {
'use strict';
angular.module('anbud')
.controller('treeController', ['$scope', 'api', '$log', …Run Code Online (Sandbox Code Playgroud) templates scope compiler-errors angularjs angularjs-directive
我的Web应用程序在Chrome,Firefox和Edge中运行良好,但当然不适用于IE 11.可能不是IE的旧版本.这是一个使用Angular Cli生成应用程序的最小应用程序.
完整错误:
EXCEPTION: Can't resolve all parameters for [object Location]: (?).
EXCEPTION: Can't resolve all parameters for [object Location]: (?).
Unhandled Promise rejection: (SystemJS) Can't resolve all parameters for [object Location]: (?).
Evaluating http://localhost:4200/main.js
Error loading http://localhost:4200/main.js ; Zone: <root> ; Task: Promise.then ; Value: Error: (SystemJS) Can't resolve all parameters for [object Location]: (?).
Evaluating http://localhost:4200/main.js
Error loading http://localhost:4200/main.js
"Unhandled Promise rejection:"
"(SystemJS) Can't resolve all parameters for [object Location]: (?).
Evaluating http://localhost:4200/main.js
Error loading http://localhost:4200/main.js"
"; …Run Code Online (Sandbox Code Playgroud) 我正在尝试运行i18n提取工具来翻译我的角度2应用程序.但是当我试图跑步时,我得到:
Failed on type {"filePath":"C:/ng/anbud/src/app/_common/logging-error handler.ts","name":"LoggingErrorHandler"} with error Error: Error encountered resolving symbol values statically. Could
not resolve type LoggingErrorHandlerOptions (position 34:53 in the original .ts file), resolving symbol LoggingErrorHandler in C:/ng/anbud/src/app/_common/logging-error-handler.ts
Error: Error encountered resolving symbol values statically. Could not resolve type LoggingErrorHandlerOptions (position 34:53 in the original .ts file), resolving symbol LoggingErrorHandle
r in C:/ng/anbud/src/app/_common/logging-error-handler.ts
at simplifyInContext (C:\ng\anbud\node_modules\@angular\compiler-cli\src\static_reflector.js:469:23)
at StaticReflector.simplify (C:\ng\anbud\node_modules\@angular\compiler-cli\src\static_reflector.js:472:22)
at StaticReflector.parameters (C:\ng\anbud\node_modules\@angular\compiler-cli\src\static_reflector.js:102:47)
at CompileMetadataResolver.getDependenciesMetadata (C:\ng\anbud\node_modules\@angular\compiler\bundles\compiler.umd.js:14317:56)
at CompileMetadataResolver.getTypeMetadata (C:\ng\anbud\node_modules\@angular\compiler\bundles\compiler.umd.js:14282:28)
at CompileMetadataResolver.getProviderMetadata (C:\ng\anbud\node_modules\@angular\compiler\bundles\compiler.umd.js:14473:42)
at C:\ng\anbud\node_modules\@angular\compiler\bundles\compiler.umd.js:14421:47
at Array.forEach (native) …Run Code Online (Sandbox Code Playgroud) error-handling compiler-errors internationalization angular2-aot angular
当我的用户使用他们的用户名和用户ID保存在会话变量中时,他们可以使用paypal捐赠.使用简单的立即购买按钮,您可以简单地在贝宝生成.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="XXX">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
Run Code Online (Sandbox Code Playgroud)
付款成功后,会将所有_POST数据发送到我的confirm_payment.php.我可以使用他们支付的邮件,并将其与我的用户数据库进行比较,以找到正确的用户,但我不能确定他们使用相同的电子邮件为paypal和我的网站.
我需要将$ _SESSION ['用户名']传递给paypal,这样我就可以使用这些信息自动为我的用户提供捐赠者状态.我可以添加如下内容:
<input type="hidden" name="custom" value="custom variable">
Run Code Online (Sandbox Code Playgroud)
我正在PRO PHP AND JQUERY阅读本书中的一些例子,但由于某种原因,这些例子不起作用.即使我从书籍网站下载的示例也不起作用.不确定什么是错的,因为我完全按照书中所做的那样做.
/public/Index.php
include_once '../sys/core/init.inc.php';
$cal = new Calendar($dbo, "2010-01-01 12:00:00"); //ERROR Class 'Calendar' not found
Run Code Online (Sandbox Code Playgroud)
/sys/core/init.inc.php
function __autoload($class)
{
$filename = "../sys/class/class." . $class . ".inc.php";
if ( file_exists($filename) )
{
include_once $filename;
}
}
Run Code Online (Sandbox Code Playgroud)
/sys/class/class.calendar.inc.php
class Calendar extends DB_Connect
{
private $_useDate;
private $_m;
private $_y;
private $_daysInMonth;
private $_startDay;
/**
* Create a database containg relevant info
*
* @param object $dbo a database object
* @param string $useDate the date to build …Run Code Online (Sandbox Code Playgroud) 当我尝试使用--prod选项运行ng build时,它会编译成一个main.js文件,并且我在控制台中没有错误.
但是当我在浏览器中运行应用程序时,它仍然会查找单个js文件.
我的主要内容:
// default
import { provide, enableProdMode, ExceptionHandler } from '@angular/core';
import { LocationStrategy, HashLocationStrategy } from '@angular/common';
import { bootstrap } from '@angular/platform-browser-dynamic';
import { HTTP_PROVIDERS, Http } from '@angular/http';
// External
import {
TranslateService, TranslateLoader, TranslateStaticLoader
} from 'ng2-translate/ng2-translate';
import {Angulartics2} from 'angulartics2';
// mine
import { CustomExceptionHandler } from './app/_common/CustomExceptionHandler';
import { UserService } from './app/_services/user.service';
import { MessagesService } from './app/_services/messages.service';
import { APP_ROUTER_PROVIDERS } from './app/app.routes';
import { App, environment …Run Code Online (Sandbox Code Playgroud) php ×4
angular ×3
javascript ×2
post ×2
angular-cli ×1
angular2-aot ×1
angularjs ×1
arrays ×1
autoload ×1
c# ×1
class ×1
forms ×1
html ×1
mysql ×1
object ×1
paypal ×1
paypal-ipn ×1
require ×1
scope ×1
select ×1
templates ×1
testing ×1
unit-testing ×1
variables ×1
web ×1