这段代码可以正常工作,但是我需要使用PHP用MySQL表中的值替换数据部分:
#include <iostream>
#include <vector>
template<class T>
class allocator {
public:
typedef T value_type;
using propagate_on_container_copy_assignment = std::true_type; // for consistency
using propagate_on_container_move_assignment = std::true_type; // to avoid the pessimization
using propagate_on_container_swap = std::true_type; // to avoid the undefined behavior
allocator<T> select_on_container_copy_construction() const {
throw std::bad_alloc();
}
T *allocate(const std::size_t n) {
return static_cast<T *>(::operator new(n * sizeof(T)));
}
void deallocate(T *, const std::size_t) { }
};
template< class T1, class T2 >
bool operator==(const allocator<T1>&, const allocator<T2>&) noexcept {
return true;
}
template< class T1, class T2 >
bool operator!=(const allocator<T1>&, const allocator<T2>&) noexcept {
return false;
}
int main()
{
try {
std::basic_string<char, std::char_traits<char>, allocator<char>> s;
auto ss = s;
} catch (std::bad_alloc const&) {
std::cout << "string worked\n";
}
try {
std::vector<int, allocator<int>> v;
auto vv = v;
} catch (std::bad_alloc const&) {
std::cout << "vector worked\n";
}
}
我想使用PHP / MySQL用MySQL表中的数据替换“数据”部分。我尝试了这个,但是它总是返回错误:
function() {
"use strict";
angular.module("app.table").controller("nutritionController", ["$mdEditDialog", "$q", "$scope", "$timeout", function(e, t, a, o) {
a.selected = [],
a.limitOptions = [25, 50, 150, 300],
a.options = {
rowSelection: !1,
multiSelect: !1,
autoSelect: !1,
decapitate: !1,
largeEditDialog: !1,
boundaryLinks: !1,
limitSelect: !0,
pageSelect: !1},
a.query = {
order: "stu",
limit: 50,
page: 1},
a.desserts = {
count: 2,
data: [{
stu: "yada1",
mod: "yada1",
cat: "yada1",
com: "yada1",
cru: "yada1",
for: "yada1",
con: "yada1",
cmt: "yada1",
}, {
stu: "yada2",
mod: "yada2",
cat: "yada2",
com: "yada2",
cru: "yada2",
for: "yada2",
con: "yada2",
cmt: "yada2",
}]
}
}])
}()
这是PHP文件:
a.desserts = {
count: 2,
data: function($scope, $http) {
$http.get("/URL/maindb.php")
.then(function (response) {$scope = response.data.records})
}